📄 frm_empedit.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form Frm_EmpEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑员工信息"
ClientHeight = 3150
ClientLeft = 45
ClientTop = 330
ClientWidth = 7245
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3150
ScaleWidth = 7245
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtMobile
Alignment = 1 'Right Justify
Height = 270
Left = 5040
MaxLength = 10
TabIndex = 16
Top = 1320
Width = 1935
End
Begin VB.TextBox txtOffice
Alignment = 1 'Right Justify
Height = 270
Left = 1440
MaxLength = 10
TabIndex = 14
Top = 1320
Width = 1935
End
Begin VB.TextBox txtAge
Alignment = 1 'Right Justify
Height = 270
Left = 3480
MaxLength = 50
TabIndex = 12
Top = 795
Width = 1095
End
Begin VB.ComboBox cboSex
Height = 300
ItemData = "Frm_EmpEdit.frx":0000
Left = 1440
List = "Frm_EmpEdit.frx":000A
Style = 2 'Dropdown List
TabIndex = 10
Top = 780
Width = 735
End
Begin MSDataListLib.DataCombo DataCombo1
Bindings = "Frm_EmpEdit.frx":0016
Height = 330
Left = 5040
TabIndex = 1
Top = 240
Width = 1935
_ExtentX = 3413
_ExtentY = 582
_Version = 393216
Style = 2
ListField = "DepName"
BoundColumn = "DepId"
Text = "DataCombo1"
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 2520
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=人事.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=人事.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "Departments"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 495
Left = 1942
TabIndex = 4
Top = 2400
Width = 1335
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取 消"
Height = 495
Left = 4087
TabIndex = 5
Top = 2400
Width = 1215
End
Begin VB.TextBox txtSallary
Alignment = 1 'Right Justify
Height = 270
Left = 1440
MaxLength = 10
TabIndex = 3
Top = 1800
Width = 1935
End
Begin VB.TextBox txtTitle
Alignment = 1 'Right Justify
Height = 270
Left = 5880
MaxLength = 50
TabIndex = 2
Top = 795
Width = 1095
End
Begin VB.TextBox txtEmpName
Alignment = 1 'Right Justify
Height = 270
Left = 1440
MaxLength = 10
TabIndex = 0
Top = 315
Width = 1935
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "移动电话"
Height = 180
Left = 3960
TabIndex = 17
Top = 1365
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "办公电话"
Height = 180
Left = 360
TabIndex = 15
Top = 1365
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "年龄"
Height = 180
Left = 2640
TabIndex = 13
Top = 840
Width = 360
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "职务"
Height = 180
Left = 5040
TabIndex = 11
Top = 840
Width = 360
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "工资"
Height = 180
Left = 360
TabIndex = 9
Top = 1845
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别"
Height = 180
Left = 360
TabIndex = 8
Top = 840
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "所在部门"
Height = 180
Left = 3960
TabIndex = 7
Top = 285
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "员工姓名"
Height = 180
Left = 360
TabIndex = 6
Top = 360
Width = 720
End
End
Attribute VB_Name = "Frm_EmpEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriId As Long
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'判断用户数据的有效性
If Trim(txtEmpName) = "" Then
MsgBox "请输入员工姓名"
txtEmpName.SetFocus '设置焦点
Exit Sub
End If
If DataCombo1.SelectedItem = "" Then
MsgBox "请选择员工所在部门"
DataCombo1.SetFocus
Exit Sub
End If
'将用户录入的数据赋值到MyEmp对象中
With MyEmp
'设置员工姓名
.EmpName = MakeStr(txtEmpName)
'设置部门编号,BoundText为选择部门的编号
.DepId = DataCombo1.BoundText
'设置性别
.Sex = cboSex.Text
'设置年龄
.Age = Val(txtAge)
'设置职务
.Title = MakeStr(txtTitle)
'设置办公电话
.Office_phone = MakeStr(txtOffice)
'设置移动电话
.Mobile_phone = MakeStr(txtMobile)
'设置工资
.Sallary = Val(txtSallary)
'根据Modify变量的值决定是修改数据还是添加新数据
If Modify = False Then
'插入新员工数据
.Insert
Else
'修改数据
.Update (OriId)
End If
End With
MsgBox ("数据已保存")
'关闭窗体
Unload Me
End Sub
Private Sub txtAge_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtEmpName_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtMobile_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtOffice_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtSallary_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtTitle_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -