📄 frminput.frm
字号:
VERSION 5.00
Begin VB.Form frmEmpAdd
BackColor = &H0080C0FF&
BorderStyle = 3 'Fixed Dialog
Caption = "员工信息"
ClientHeight = 3360
ClientLeft = 45
ClientTop = 330
ClientWidth = 6435
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3360
ScaleWidth = 6435
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4800
TabIndex = 11
Top = 2880
Width = 1455
End
Begin VB.CommandButton cmdSave
BackColor = &H00000000&
Caption = "保存(&S)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
TabIndex = 10
Top = 2880
Width = 1455
End
Begin VB.TextBox txtAddress
Height = 375
Left = 1200
TabIndex = 9
Top = 2280
Width = 4815
End
Begin VB.ComboBox cmbDate
Height = 300
Left = 1200
Style = 2 'Dropdown List
TabIndex = 7
Top = 1800
Width = 2175
End
Begin VB.TextBox txtAge
Height = 375
Left = 1200
TabIndex = 5
Top = 1200
Width = 2175
End
Begin VB.TextBox txtName
Height = 375
Left = 1200
TabIndex = 3
Top = 720
Width = 2175
End
Begin VB.TextBox txtCode
Height = 375
Left = 1200
MaxLength = 32
TabIndex = 1
Top = 240
Width = 2175
End
Begin VB.Line Line3
BorderColor = &H00E0E0E0&
X1 = 120
X2 = 6240
Y1 = 2760
Y2 = 2760
End
Begin VB.Label Label5
BackColor = &H0080C0FF&
Caption = "员工地址"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 8
Top = 2280
Width = 975
End
Begin VB.Label Label4
BackColor = &H0080C0FF&
Caption = "加入年龄"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 6
Top = 1800
Width = 855
End
Begin VB.Label Label3
BackColor = &H0080C0FF&
Caption = "员工年龄"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 4
Top = 1320
Width = 975
End
Begin VB.Label Label2
BackColor = &H0080C0FF&
Caption = "员工姓名"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 2
Top = 840
Width = 975
End
Begin VB.Label Label1
BackColor = &H0080C0FF&
Caption = "员工号码"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 0
Top = 360
Width = 855
End
Begin VB.Line Line4
BorderColor = &H00E0E0E0&
X1 = 6240
X2 = 6240
Y1 = 120
Y2 = 2760
End
Begin VB.Line Line2
BorderColor = &H00E0E0E0&
X1 = 120
X2 = 120
Y1 = 120
Y2 = 2760
End
Begin VB.Line Line1
BorderColor = &H00E0E0E0&
X1 = 6240
X2 = 120
Y1 = 120
Y2 = 120
End
End
Attribute VB_Name = "frmEmpAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClose_Click()
Unload Me
frmLogin.Show
End Sub
Private Sub cmdStore_Click()
MsgBox "记录已被保存!"
End Sub
Private Sub cmdSave_Click()
' 前面章节的内容
' MsgBox "输入的信息如下 :" & vbCrLf & _
' "员工号码 :" & Trim(metrim(txtCode)) & vbCrLf & _
' "员工姓名 :" & Trim(metrim(txtName)) & vbCrLf & _
' "员工年龄 :" & Trim(metrim(txtAge)) & vbCrLf & _
' "加入日期 :" & Trim(metrim(cmbDate.Text)) & vbCrLf & _
' "员工地址 :" & Trim(metrim(txtAddress.Text)), vbOKOnly, "保存的信息"
Dim strInsertSQL As String
If (txtName.Text = Empty) Or (txtCode.Text = Empty) Or (txtAge.Text = Empty) _
Or (cmbDate.Text = Empty) Or (txtAddress.Text = Empty) Then
MsgBox "请输入所有的数据...", vbInformation + vbOKOnly, "数据不完整"
Else
Call WriteInfoToText(Trim(MeTrim(txtCode)), Trim(MeTrim(txtName)), _
Trim(MeTrim(txtAge)), Trim(MeTrim(cmbDate.Text)), Trim(MeTrim(txtAddress.Text)))
strInsertSQL = "INSERT INTO EMPLIST (ENumber,Ename,Eage,Edate,Eaddress) VALUES ("
strInsertSQL = strInsertSQL & "'" & Trim(MeTrim(txtCode)) & "',"
strInsertSQL = strInsertSQL & "'" & Trim(MeTrim(txtName)) & "',"
strInsertSQL = strInsertSQL & "'" & Trim(MeTrim(txtAge)) & "',"
strInsertSQL = strInsertSQL & "'" & Trim(cmbDate.Text) & "',"
strInsertSQL = strInsertSQL & "'" & Trim(MeTrim(txtAddress)) & "')"
If ExecuteSQL(strInsertSQL) = True Then
MsgBox "员工信息已经保存...", vbInformation + vbOKOnly, "保存成功"
Unload Me
End If
End If
End Sub
Private Sub Form_Load()
Dim intindex As Long
For intindex = 2000 To 2005
cmbDate.AddItem CStr(intindex) & "年"
Next intindex
cmbDate.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -