📄 j_canpin.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form J_canpin
BackColor = &H80000013&
Caption = "产品设置"
ClientHeight = 7545
ClientLeft = 60
ClientTop = 465
ClientWidth = 7290
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 7545
ScaleWidth = 7290
Begin VB.CommandButton Command5
Caption = "确定修改"
Height = 495
Left = 5880
TabIndex = 27
Top = 120
Width = 1095
End
Begin VB.Frame Frame1
BackColor = &H80000013&
Height = 3135
Left = 240
TabIndex = 6
Top = 4080
Width = 6735
Begin VB.TextBox Text9
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 26
Top = 2640
Width = 5175
End
Begin VB.TextBox Text8
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 4440
TabIndex = 24
Top = 2160
Width = 2055
End
Begin VB.TextBox Text7
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 22
Top = 2160
Width = 1815
End
Begin VB.TextBox Text6
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 4440
TabIndex = 20
Top = 1680
Width = 2055
End
Begin VB.TextBox Text5
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 18
Top = 1680
Width = 1815
End
Begin VB.TextBox Text4
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 16
Top = 1200
Width = 5295
End
Begin VB.ComboBox Combo1
BackColor = &H80000013&
Enabled = 0 'False
Height = 300
Left = 4320
TabIndex = 14
Top = 720
Width = 2175
End
Begin VB.TextBox Text3
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 960
TabIndex = 12
Top = 720
Width = 2175
End
Begin VB.TextBox Text2
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 4320
TabIndex = 10
Top = 240
Width = 2175
End
Begin VB.TextBox Text1
BackColor = &H80000013&
Enabled = 0 'False
Height = 375
Left = 960
TabIndex = 8
Top = 240
Width = 2175
End
Begin VB.Label Label10
BackColor = &H80000013&
Caption = "备注信息:"
Height = 375
Left = 240
TabIndex = 25
Top = 2640
Width = 975
End
Begin VB.Label Label9
BackColor = &H80000013&
Caption = "设置日期:"
Height = 375
Left = 3360
TabIndex = 23
Top = 2160
Width = 975
End
Begin VB.Label Label8
BackColor = &H80000013&
Caption = "零活价格:"
Height = 375
Left = 240
TabIndex = 21
Top = 2160
Width = 975
End
Begin VB.Label Label7
BackColor = &H80000013&
Caption = "分销价格:"
Height = 375
Left = 3360
TabIndex = 19
Top = 1680
Width = 855
End
Begin VB.Label Label6
BackColor = &H80000013&
Caption = "入库价格:"
Height = 375
Left = 240
TabIndex = 17
Top = 1680
Width = 975
End
Begin VB.Label Label5
BackColor = &H80000013&
Caption = "生产厂家:"
Height = 375
Left = 240
TabIndex = 15
Top = 1200
Width = 975
End
Begin VB.Label Label4
BackColor = &H80000013&
Caption = "类别:"
Height = 375
Left = 3480
TabIndex = 13
Top = 720
Width = 735
End
Begin VB.Label Label3
BackColor = &H80000013&
Caption = "单位:"
Height = 375
Left = 240
TabIndex = 11
Top = 720
Width = 615
End
Begin VB.Label Label2
BackColor = &H80000013&
Caption = "名称:"
Height = 375
Left = 3480
TabIndex = 9
Top = 240
Width = 735
End
Begin VB.Label Label1
BackColor = &H80000013&
Caption = "款号:"
Height = 375
Left = 240
TabIndex = 7
Top = 240
Width = 615
End
End
Begin VB.CommandButton Command4
Caption = "修改记录"
Height = 495
Left = 4680
TabIndex = 5
Top = 120
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "更新"
Height = 495
Left = 2400
TabIndex = 4
Top = 120
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 495
Left = 3600
TabIndex = 3
Top = 120
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添加产品"
Height = 495
Left = 1320
TabIndex = 2
Top = 120
Width = 1095
End
Begin MSFlexGridLib.MSFlexGrid msgList
Height = 3375
Left = 240
TabIndex = 0
Top = 720
Width = 6735
_ExtentX = 11880
_ExtentY = 5953
_Version = 393216
BackColor = -2147483629
BackColorSel = -2147483647
BackColorBkg = 16761024
End
Begin VB.Label lblTitle
BackColor = &H80000013&
Caption = "产品信息"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 855
End
End
Attribute VB_Name = "J_canpin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public txtSQL As String
Dim intCount As Integer
Dim mrc As ADODB.Recordset
Dim MsgText As String
Private Sub ShowTitle()
Dim i As Integer
With msgList
.Cols = 11
.TextMatrix(0, 1) = "产品编号"
.TextMatrix(0, 2) = "产品名称"
.TextMatrix(0, 3) = "计量单位"
.TextMatrix(0, 4) = "产品类别编号"
.TextMatrix(0, 5) = "入库价格"
.TextMatrix(0, 6) = "分销价格"
.TextMatrix(0, 7) = "零货价格"
.TextMatrix(0, 8) = "生产厂家"
.TextMatrix(0, 9) = "更新日期"
.TextMatrix(0, 10) = "备注信息"
'固定表头
.FixedRows = 1
'设置各列的对齐方式
For i = 0 To 10
.ColAlignment(i) = 0
Next i
'表头项居中
.FillStyle = flexFillRepeat
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
'设置单元大小
.ColWidth(0) = 1000
.ColWidth(1) = 1000
.ColWidth(2) = 2000
.ColWidth(3) = 2000
.ColWidth(4) = 2000
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.ColWidth(8) = 1000
.ColWidth(9) = 1000
.ColWidth(10) = 1000
.Row = 1
End With
End Sub
Private Sub ShowData()
Dim j As Integer
Dim i As Integer
Dim MsgText As String
txtSQL = "select * from g_cpxinxi"
Set mrc = ExecuteSQL(txtSQL, MsgText)
With msgList
.Rows = 1
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
Select Case mrc.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
End Select
Next i
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
Private Sub Command1_Click()
Command3.Enabled = True
J_xinxisz.Show
End Sub
Private Sub Command2_Click()
If msgList.Row < 1 Then
MsgBox "数据库里的数据为空,不能删除", vbOKOnly, "提示"
Exit Sub
End If
If MsgBox("真的要删除款号为" & Trim(msgList.TextMatrix(msgList.Row, 1)) & "的纪录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
intCount = msgList.Row
txtSQL = "delete from g_cpxinxi where dm='" & Trim(msgList.TextMatrix(intCount, 1)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
End If
ShowData
End Sub
Private Sub Command3_Click()
ShowData
msgList.Refresh
MsgBox "更新成功", vbOKOnly, "提示"
Command3.Enabled = False
End Sub
Public Sub Command4_Click()
If MsgBox("真的要修改款号为" & Trim(msgList.TextMatrix(msgList.Row, 1)) & "的纪录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
intCount = msgList.Row
txtSQL = "select * from g_cpxinxi where dm='" & Trim(msgList.TextMatrix(intCount, 1)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
Text1.Text = msgList.TextMatrix(intCount, 1)
Text2.Text = msgList.TextMatrix(intCount, 2)
Text3.Text = msgList.TextMatrix(intCount, 3)
Combo1.Text = msgList.TextMatrix(intCount, 4)
Text5.Text = msgList.TextMatrix(intCount, 5)
Text6.Text = msgList.TextMatrix(intCount, 6)
Text7.Text = msgList.TextMatrix(intCount, 7)
Text4.Text = msgList.TextMatrix(intCount, 8)
Text8.Text = msgList.TextMatrix(intCount, 9)
Text9.Text = msgList.TextMatrix(intCount, 10)
Text2.Enabled = True
Text3.Enabled = True
Combo1.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text4.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
End If
Command5.Enabled = True
End Sub
Private Sub Command5_Click()
mrc.Fields(0) = Text1.Text
mrc.Fields(1) = Text2.Text
mrc.Fields(2) = Text3.Text
mrc.Fields(3) = Combo1.Text
mrc.Fields(4) = Text5.Text
mrc.Fields(5) = Text6.Text
mrc.Fields(6) = Text7.Text
mrc.Fields(7) = Text4.Text
mrc.Fields(8) = Text8.Text
mrc.Fields(9) = Text9.Text
mrc.Update
msgList.Refresh
mrc.Close
MsgBox "修改成功", vbOKOnly
Unload Me
End Sub
Private Sub Form_Load()
Command5.Enabled = False
Command3.Enabled = False
ShowTitle
ShowData
txtSQL = "select * from g_cpleibie"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
Do While Not mrc.EOF
Combo1.AddItem mrc.Fields(0)
mrc.MoveNext
Loop
End If
mrc.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -