📄 frmuser.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frmuser
Caption = "员工信息"
ClientHeight = 5340
ClientLeft = 60
ClientTop = 345
ClientWidth = 7485
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5340
ScaleWidth = 7485
Begin VB.CommandButton Command6
Caption = "退出"
Height = 375
Left = 3600
TabIndex = 17
Top = 4680
Width = 1095
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H80000013&
ForeColor = &H80000008&
Height = 3135
Left = 1920
ScaleHeight = 3105
ScaleWidth = 3225
TabIndex = 4
Top = 720
Visible = 0 'False
Width = 3255
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
ForeColor = &H8000000D&
Height = 270
Left = 1200
TabIndex = 11
Top = 225
Width = 1455
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Frmuser.frx":0000
Left = 1200
List = "Frmuser.frx":000A
TabIndex = 10
Top = 600
Width = 1455
End
Begin VB.TextBox Text2
Height = 270
Left = 1200
TabIndex = 8
Top = 1560
Width = 1695
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Frmuser.frx":0016
Left = 1200
List = "Frmuser.frx":0029
TabIndex = 7
Top = 2040
Width = 1695
End
Begin VB.CommandButton Command4
Caption = "确定"
Height = 375
Left = 240
MaskColor = &H00FFFFFF&
TabIndex = 6
Top = 2520
Width = 855
End
Begin VB.CommandButton Command5
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 5
Top = 2520
Width = 855
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 1200
TabIndex = 9
Top = 1080
Width = 1455
_ExtentX = 2566
_ExtentY = 661
_Version = 393216
Format = 23658497
CurrentDate = 37889
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "姓名:"
Height = 255
Left = 240
TabIndex = 16
Top = 240
Width = 615
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "手机号:"
Height = 255
Left = 240
TabIndex = 15
Top = 1560
Width = 735
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "部门:"
Height = 255
Left = 240
TabIndex = 14
Top = 2040
Width = 615
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "性别:"
Height = 255
Left = 240
TabIndex = 13
Top = 600
Width = 615
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "出生日期:"
Height = 255
Left = 240
TabIndex = 12
Top = 1200
Width = 975
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 4095
Left = 240
TabIndex = 3
Top = 240
Width = 6735
_ExtentX = 11880
_ExtentY = 7223
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
Locked = -1 'True
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 5400
Top = 4800
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 Command3
Caption = "删除"
Height = 375
Left = 2400
TabIndex = 2
Top = 4680
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "修改"
Height = 375
Left = 1320
TabIndex = 1
Top = 4680
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 240
TabIndex = 0
Top = 4680
Width = 1095
End
End
Attribute VB_Name = "Frmuser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Xgflag As Boolean
Private Sub Command1_Click()
Picture1.Visible = Not Picture1.Visible
If Picture1.Visible = True Then
Xgflag = False
Text1.Text = ""
Combo1.Text = ""
DTPicker1.Value = Date
Text2.Text = ""
Combo2.Text = ""
End If
End Sub
Private Sub Command2_Click()
If DataGrid1.Row >= 0 Then
Picture1.Visible = Not Picture1.Visible
If Picture1.Visible = True Then
Xgflag = True
Text1.Locked = True
Text1.BackColor = &HC0C0C0
DataGrid1.Col = 0
Text1.Text = DataGrid1.Text
DataGrid1.Col = 1
Combo1.Text = DataGrid1.Text
DataGrid1.Col = 2
DTPicker1.Value = DataGrid1.Text
DataGrid1.Col = 3
Text2.Text = DataGrid1.Text
DataGrid1.Col = 4
Combo2.Text = DataGrid1.Text
End If
End If
End Sub
Private Sub Command3_Click()
On Error Resume Next
If MsgBox("你确实要删除该信息吗?", vbQuestion + vbYesNo, "提示") = vbYes Then
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.Delete
End If
End If
End Sub
Private Sub Command4_Click()
Dim rdygxx As New ADODB.Recordset
If Xgflag = False Then
If Trim(Text1.Text) = "" Then
MsgBox "姓名不能为空!", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "手机号不能为空!", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
With rdygxx
.Open "select*from ygxx where 姓名='" & Trim(Text1.Text) & "'", Cn, adOpenDynamic, adLockPessimistic
If .EOF Then
.AddNew
.Fields!姓名 = Trim(Text1.Text)
.Fields!性别 = Trim(Combo1.Text)
.Fields!出生日期 = DTPicker1.Value
.Fields!手机号 = Trim(Text2.Text)
.Fields!部门 = Trim(Combo2.Text)
.Update
Else
MsgBox "该用户已经存在!", vbInformation + vbOKOnly, "提示!"
End If
.Close
End With
With rdygxx
.Open "select*from ygxx", Cn, adOpenDynamic, adLockPessimistic
.Close
End With
Adodc1.Refresh
Else
If Trim(Text2.Text) = "" Then
MsgBox "手机号不能为空!", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
With rdygxx
.Open "select*from ygxx where 姓名='" & Trim(Text1.Text) & "'", Cn, adOpenDynamic, adLockPessimistic
If Not .EOF Then
.Fields!性别 = Trim(Combo1.Text)
.Fields!出生日期 = DTPicker1.Value
.Fields!手机号 = Trim(Text2.Text)
.Fields!部门 = Trim(Combo2.Text)
.Update
Else
MsgBox "该用户不存在!", vbInformation + vbOKOnly, "提示!"
End If
.Close
End With
With rdygxx
.Open "select*from ygxx", Cn, adOpenDynamic, adLockPessimistic
.Close
End With
Adodc1.Refresh
Text1.Locked = False
Text1.BackColor = &HFFFFFF
End If
End Sub
Private Sub Command5_Click()
Picture1.Visible = False
Text1.Locked = False
Text1.BackColor = &HFFFFFF
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub DataGrid1_DblClick()
DataGrid1.Col = 3
FrmSendSms.Text1.Text = DataGrid1.Text
Unload Me
End Sub
Private Sub Form_Load()
Me.Width = 7600
Me.Height = 6000
Adodc1.ConnectionString = Cn
Adodc1.RecordSource = "select 姓名,性别,出生日期,手机号,部门 from ygxx"
Set DataGrid1.DataSource = Adodc1
End Sub
Private Sub Form_Paint()
On Error Resume Next
Me.Move 0, 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -