📄 frmyggl.frm
字号:
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Height = 1695
Left = 120
TabIndex = 1
Top = 120
Width = 10215
Begin VB.ComboBox cmbsex
DataField = "性别"
DataSource = "Adodc1"
Height = 300
ItemData = "frmyggl.frx":0015
Left = 5400
List = "frmyggl.frx":001F
TabIndex = 19
Top = 360
Width = 1695
End
Begin VB.TextBox txtaddress
DataField = "家庭住址"
DataSource = "Adodc1"
Height = 1020
Left = 7680
MultiLine = -1 'True
TabIndex = 13
Top = 360
Width = 2295
End
Begin VB.TextBox txttel
DataField = "电话"
DataSource = "Adodc1"
Height = 300
Left = 3000
TabIndex = 12
Top = 1080
Width = 1695
End
Begin VB.ComboBox cmbdep
DataField = "部门"
DataSource = "Adodc1"
Height = 300
ItemData = "frmyggl.frx":002B
Left = 3000
List = "frmyggl.frx":0062
TabIndex = 7
Top = 360
Width = 1695
End
Begin VB.TextBox txtage
DataField = "年龄"
DataSource = "Adodc1"
Height = 300
Left = 5400
MaxLength = 2
TabIndex = 6
Top = 1080
Width = 1695
End
Begin VB.TextBox txtname
DataField = "姓名"
DataSource = "Adodc1"
Height = 300
Left = 720
TabIndex = 5
Top = 1080
Width = 1695
End
Begin VB.Label Label8
Caption = "性别"
Height = 255
Left = 4920
TabIndex = 18
Top = 480
Width = 495
End
Begin VB.Label Label7
Caption = "住址"
Height = 255
Left = 7200
TabIndex = 11
Top = 480
Width = 495
End
Begin VB.Label Label6
Caption = "电话"
Height = 255
Left = 2520
TabIndex = 10
Top = 1200
Width = 495
End
Begin VB.Label Label2
Caption = "部门"
Height = 255
Left = 2520
TabIndex = 9
Top = 480
Width = 495
End
Begin VB.Label Label5
Caption = "年龄"
Height = 255
Left = 4920
TabIndex = 8
Top = 1200
Width = 495
End
Begin VB.Label Label1
Caption = "姓名"
Height = 255
Left = 240
TabIndex = 4
Top = 1200
Width = 495
End
Begin VB.Label Label4
DataField = "编号"
DataSource = "Adodc1"
BeginProperty Font
Name = "Arial Black"
Size = 21.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 1080
TabIndex = 3
Top = 240
Width = 855
End
Begin VB.Label Label3
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 = 240
TabIndex = 2
Top = 360
Width = 615
End
End
End
Attribute VB_Name = "frmyggl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
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 cmbdep = "" Then
MsgBox "部门不能为空", vbCritical, "员工管理"
cmbdep.SetFocus
Else
Adodc1.Recordset.Fields("姓名") = txtname.Text
Adodc1.Recordset.Fields("部门") = cmbdep.Text
Adodc1.Recordset.Fields("电话") = txttel.Text
Adodc1.Recordset.Fields("性别") = cmbsex.Text
Adodc1.Recordset.Fields("年龄") = txtage.Text
Adodc1.Recordset.Fields("家庭住址") = txtaddress.Text
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 cmbdep = "" Then
MsgBox "部门不能为空", vbCritical, "员工管理"
cmbdep.SetFocus
Else
Adodc1.Recordset.Fields("姓名") = txtname.Text
Adodc1.Recordset.Fields("部门") = cmbdep.Text
Adodc1.Recordset.Fields("电话") = txttel.Text
Adodc1.Recordset.Fields("性别") = cmbsex.Text
Adodc1.Recordset.Fields("年龄") = txtage.Text
Adodc1.Recordset.Fields("家庭住址") = txtaddress.Text
Adodc1.Recordset.Update
Adodc1.RecordSource = "select * from 员工表 order by 编号"
Adodc1.Refresh
End If
End Sub
Private Sub Form_Load()
cmdsave.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -