📄 renyuan.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form renyuan
Caption = "人员管理"
ClientHeight = 6075
ClientLeft = 60
ClientTop = 345
ClientWidth = 10125
LinkTopic = "Form1"
ScaleHeight = 6075
ScaleWidth = 10125
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 2295
Left = 0
TabIndex = 10
Top = 0
Width = 10095
Begin VB.CheckBox Check1
Caption = "管理员"
Height = 375
Left = 4920
TabIndex = 19
Top = 1560
Width = 1215
End
Begin VB.TextBox Text7
Height = 375
Left = 7800
TabIndex = 5
Top = 840
Width = 1935
End
Begin VB.TextBox Text6
Height = 375
Left = 7800
TabIndex = 2
Top = 240
Width = 1935
End
Begin VB.TextBox Text5
Height = 855
Left = 1080
MultiLine = -1 'True
TabIndex = 6
Top = 1320
Width = 3615
End
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
Height = 375
Left = 1080
TabIndex = 0
Top = 240
Width = 2415
End
Begin VB.TextBox Text2
ForeColor = &H00000000&
Height = 375
Left = 4800
TabIndex = 1
Top = 240
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "保存"
Height = 495
Left = 7800
TabIndex = 8
Top = 1440
Width = 855
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 9000
TabIndex = 9
Top = 1440
Width = 855
End
Begin VB.CommandButton Command3
Caption = "添加"
Height = 495
Left = 6600
TabIndex = 7
Top = 1440
Width = 975
End
Begin VB.TextBox Text3
Height = 375
Left = 1080
TabIndex = 3
Top = 840
Width = 2415
End
Begin VB.TextBox Text4
Height = 375
Left = 4800
TabIndex = 4
Top = 840
Width = 1815
End
Begin VB.Label Label7
Caption = "登录密码:"
Height = 255
Left = 6840
TabIndex = 18
Top = 840
Width = 975
End
Begin VB.Label Label1
Caption = "人员姓名:"
Height = 255
Left = 120
TabIndex = 17
Top = 360
Width = 1095
End
Begin VB.Label Label2
Caption = "底薪:"
Height = 255
Left = 4080
TabIndex = 16
Top = 840
Width = 615
End
Begin VB.Label Label3
Caption = "联系电话:"
Height = 255
Left = 3720
TabIndex = 15
Top = 360
Width = 1095
End
Begin VB.Label Label4
Caption = "家庭住址:"
Height = 375
Left = 120
TabIndex = 14
Top = 960
Width = 1095
End
Begin VB.Label Label5
Caption = "员工代码:"
Height = 375
Left = 6840
TabIndex = 13
Top = 360
Width = 975
End
Begin VB.Label Label6
Caption = "备注:"
Height = 255
Left = 120
TabIndex = 12
Top = 1560
Width = 975
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3615
Left = 0
TabIndex = 11
Top = 2400
Width = 10095
_ExtentX = 17806
_ExtentY = 6376
_Version = 393216
End
End
Attribute VB_Name = "renyuan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Trecordset As New ADODB.Recordset
Sub Gridflex()
'init the headers of the msflexgrid1
MSFlexGrid1.Cols = 8
MSFlexGrid1.TextMatrix(0, 0) = "编号"
MSFlexGrid1.TextMatrix(0, 1) = "员工代号"
MSFlexGrid1.TextMatrix(0, 2) = "员工姓名"
MSFlexGrid1.TextMatrix(0, 3) = "登录密码"
MSFlexGrid1.TextMatrix(0, 4) = "联系电话"
MSFlexGrid1.TextMatrix(0, 5) = "联系地址"
MSFlexGrid1.TextMatrix(0, 6) = "底薪"
MSFlexGrid1.TextMatrix(0, 7) = "备注"
MSFlexGrid1.ColWidth(0) = 500
MSFlexGrid1.ColWidth(1) = 900
MSFlexGrid1.ColWidth(2) = 900
MSFlexGrid1.ColWidth(3) = 900
MSFlexGrid1.ColWidth(4) = 1500
MSFlexGrid1.ColWidth(5) = 2100
MSFlexGrid1.ColWidth(6) = 900
MSFlexGrid1.ColWidth(7) = 3200
MSFlexGrid1.Rows = Trecordset.RecordCount + 1
If Trecordset.RecordCount > 0 Then Trecordset.MoveFirst
t = 1
Do While Not Trecordset.EOF
MSFlexGrid1.TextMatrix(t, 0) = Trecordset.Fields("id")
MSFlexGrid1.TextMatrix(t, 1) = Trecordset.Fields("haoma")
MSFlexGrid1.TextMatrix(t, 2) = Trecordset.Fields("name")
MSFlexGrid1.TextMatrix(t, 3) = Trecordset.Fields("password")
MSFlexGrid1.TextMatrix(t, 4) = Trecordset.Fields("tel")
MSFlexGrid1.TextMatrix(t, 5) = Trecordset.Fields("dizhi")
MSFlexGrid1.TextMatrix(t, 6) = Trecordset.Fields("gongzi")
MSFlexGrid1.TextMatrix(t, 7) = Trecordset.Fields("beizhu")
Trecordset.MoveNext
t = t + 1
Loop
End Sub
Private Sub Command1_Click()
' Do While Not Trecordset.EOF
If Trim(Text1.Text) = "" Then
MsgBox "员工姓名不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "联系电话不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Text3.Text) = "" Then
MsgBox "联系地址不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Text4.Text) = "" Then
MsgBox "底薪不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Text6.Text) = "" Then
MsgBox "员工代码不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Text7.Text) = "" Then
MsgBox "密码不能为空!", vbOKOnly, "提示"
Exit Sub
End If
Trecordset.AddNew
Trecordset.Fields("name") = Trim(Text1.Text)
Trecordset.Fields("tel") = Trim(Text2.Text)
Trecordset.Fields("dizhi") = Trim(Text3.Text)
Trecordset.Fields("gongzi") = Trim(Text4.Text)
Trecordset.Fields("beizhu") = Trim(Text5.Text)
Trecordset.Fields("haoma") = Trim(Text6.Text)
Trecordset.Fields("password") = Trim(Text7.Text)
If Check1.Value = 1 Then
Trecordset.Fields("guanliyuan") = 1
Else
Trecordset.Fields("guanliyuan") = 0
End If
' Trecordset.MoveNext
' Loop
Trecordset.Update
Trecordset.Requery
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text1.BackColor = &H80000004
Text2.BackColor = &H80000004
Text3.BackColor = &H80000004
Text4.BackColor = &H80000004
Text5.BackColor = &H80000004
Text6.BackColor = &H80000004
Text7.BackColor = &H80000004
Command3.Enabled = True
Command1.Enabled = False
Unload Me
Load renyuan
renyuan.Show
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Command1.Enabled = True
Text1.BackColor = &HFFFFFF
Text2.BackColor = &HFFFFFF
Text3.BackColor = &HFFFFFF
Text4.BackColor = &HFFFFFF
Text5.BackColor = &HFFFFFF
Text6.BackColor = &HFFFFFF
Text7.BackColor = &HFFFFFF
Command3.Enabled = False
End Sub
Private Sub Form_Load()
'set the window in the middle
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
'********
' Option1.Value = False
'open the DSN
With Trecordset
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select * from yuangong order by id desc"
.Open
End With
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Command1.Enabled = False
Text1.BackColor = &H80000004
Text2.BackColor = &H80000004
Text3.BackColor = &H80000004
Text4.BackColor = &H80000004
Text5.BackColor = &H80000004
Text6.BackColor = &H80000004
Text7.BackColor = &H80000004
Gridflex
End Sub
Private Sub Form_Unload(Cancel As Integer)
Trecordset.Close
Set Trecordset = Nothing
End Sub
Private Sub MSFlexGrid1_Click()
renyuanID = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 0))
Load renyuanModify
renyuanModify.Show
Unload renyuan
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -