📄 frmljgl.frm
字号:
ColumnWidth = 2085.166
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Height = 4575
Left = 7800
TabIndex = 0
Top = 120
Width = 3375
Begin MSComCtl2.DTPicker dtpgmrq
DataField = "购买日期"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 15
Top = 3960
Width = 1935
_ExtentX = 3413
_ExtentY = 661
_Version = 393216
Format = 25559041
CurrentDate = 39753
End
Begin VB.TextBox txtcj
DataField = "生产厂家"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 12
Text = "Text4"
Top = 3315
Width = 1935
End
Begin VB.TextBox txtdj
DataField = "单价"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 10
Text = "Text3"
Top = 2685
Width = 1935
End
Begin VB.ComboBox cmblb
DataField = "类别"
DataSource = "Adodc1"
Height = 300
ItemData = "frmljgl.frx":0015
Left = 1200
List = "frmljgl.frx":003A
TabIndex = 8
Text = "Combo1"
Top = 2115
Width = 1935
End
Begin VB.TextBox txtxh
DataField = "型号"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 6
Text = "Text2"
Top = 1485
Width = 1935
End
Begin VB.TextBox txtname
DataField = "名称"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 4
Text = "Text1"
Top = 840
Width = 1935
End
Begin VB.Label Label8
Caption = "购买日期"
Height = 255
Left = 240
TabIndex = 13
Top = 4080
Width = 735
End
Begin VB.Label Label7
Caption = "生产厂家"
Height = 255
Left = 240
TabIndex = 11
Top = 3450
Width = 735
End
Begin VB.Label Label6
Caption = "零件单价"
Height = 255
Left = 240
TabIndex = 9
Top = 2835
Width = 735
End
Begin VB.Label Label5
Caption = "零件类别"
Height = 255
Left = 240
TabIndex = 7
Top = 2205
Width = 735
End
Begin VB.Label Label4
Caption = "零件型号"
Height = 255
Left = 240
TabIndex = 5
Top = 1590
Width = 735
End
Begin VB.Label Label3
Caption = "零件名称"
Height = 255
Left = 240
TabIndex = 3
Top = 960
Width = 735
End
Begin VB.Label Label2
DataField = "编号"
DataSource = "Adodc1"
BeginProperty Font
Name = "Arial Black"
Size = 15.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 1200
TabIndex = 2
Top = 240
Width = 855
End
Begin VB.Label Label1
Caption = "NO."
BeginProperty Font
Name = "Arial Black"
Size = 15.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 1
Top = 240
Width = 735
End
End
End
Attribute VB_Name = "frmljgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdadd_Click()
Adodc1.RecordSource = "select * from 零件表 order by 编号"
Adodc1.Refresh
Adodc1.Recordset.AddNew
txtname.SetFocus
cmdadd.Enabled = False
cmdupdate.Enabled = False
cmddelete.Enabled = False
cmdsave.Enabled = True
cmdexit.Enabled = False
End Sub
Private Sub cmddelete_Click()
a = MsgBox("你真的要删除" + Adodc1.Recordset.Fields("名称") + "吗", vbQuestion + vbYesNo, "零件管理")
If a = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Adodc1.Recordset.MoveLast
Else
Exit Sub
End If
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdsave_Click()
If txtname.Text = "" Then
MsgBox "零件名称不能为空", vbCritical, "零件管理"
txtname.SetFocus
ElseIf cmblb = "" Then
MsgBox "零件类别不能为空", vbCritical, "零件管理"
cmblb.SetFocus
Else
Adodc1.Recordset.Fields("名称") = txtname.Text
Adodc1.Recordset.Fields("型号") = txtxh.Text
Adodc1.Recordset.Fields("类别") = cmblb.Text
Adodc1.Recordset.Fields("单价") = txtdj.Text
Adodc1.Recordset.Fields("生产厂家") = txtcj.Text
Adodc1.Recordset.Fields("购买日期") = dtpgmrq.Value
Adodc1.Recordset.Update
Adodc1.RecordSource = "select * from 零件表 order by 编号"
Adodc1.Refresh
Adodc1.Recordset.MoveLast
cmdadd.Enabled = True
cmdupdate.Enabled = True
cmddelete.Enabled = True
cmdsave.Enabled = False
cmdexit.Enabled = True
End If
End Sub
Private Sub cmdupdate_Click()
If txtname.Text = "" Then
MsgBox "零件名称不能为空", vbCritical, "零件管理"
txtname.SetFocus
ElseIf cmblb = "" Then
MsgBox "零件类别不能为空", vbCritical, "零件管理"
cmblb.SetFocus
Else
Adodc1.Recordset.Fields("名称") = txtname.Text
Adodc1.Recordset.Fields("型号") = txtxh.Text
Adodc1.Recordset.Fields("类别") = cmblb.Text
Adodc1.Recordset.Fields("单价") = txtdj.Text
Adodc1.Recordset.Fields("生产厂家") = txtcj.Text
Adodc1.Recordset.Fields("购买日期") = dtpgmrq.Value
Adodc1.Recordset.Update
Adodc1.RecordSource = "select * from 零件表 order by 编号"
Adodc1.Refresh
Adodc1.Recordset.MoveLast
End If
End Sub
Private Sub Form_Load()
cmdsave.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -