📄 main_czysz.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form main_czysz
BackColor = &H8000000B&
BorderStyle = 1 'Fixed Single
Caption = "操作员设置"
ClientHeight = 3300
ClientLeft = 45
ClientTop = 330
ClientWidth = 6000
Icon = "main_czysz.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3300
ScaleWidth = 6000
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 600
Top = 4200
Width = 1815
_ExtentX = 3201
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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 = "Adodc2"
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 MSAdodcLib.Adodc Adodc1
Height = 375
Left = 3360
Top = 3840
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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 Command2
Caption = "取消"
Height = 375
Left = 2205
MaskColor = &H8000000B&
Style = 1 'Graphical
TabIndex = 8
Top = 2790
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 480
MaskColor = &H8000000B&
Style = 1 'Graphical
TabIndex = 7
Top = 2790
Width = 1575
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 3930
MaskColor = &H8000000B&
Style = 1 'Graphical
TabIndex = 6
Top = 2790
Width = 1575
End
Begin VB.Frame Frame1
Height = 2625
Left = 105
TabIndex = 0
Top = 135
Width = 5745
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
Height = 345
Left = 2010
TabIndex = 3
Top = 1020
Width = 2880
End
Begin VB.TextBox Text2
BackColor = &H00FFFFFF&
Height = 345
IMEMode = 3 'DISABLE
Left = 2010
MaxLength = 50
TabIndex = 2
Top = 1545
Width = 2880
End
Begin VB.TextBox Text3
BackColor = &H00FFFFFF&
Height = 360
IMEMode = 3 'DISABLE
Left = 2010
MaxLength = 50
PasswordChar = "*"
TabIndex = 1
Top = 2070
Width = 2880
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请输入操作员代号和密码"
BeginProperty Font
Name = "华文行楷"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 270
TabIndex = 5
Top = 270
Width = 4215
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "操作员 密 码 确 认"
Height = 1515
Left = 1395
TabIndex = 4
Top = 1080
Width = 1005
End
End
End
Attribute VB_Name = "main_czysz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
'自动识别数据库路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tb_qxsz"
Adodc1.Refresh
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
Adodc2.RecordSource = "select * from tb_user"
Adodc2.Refresh
End Sub
Private Sub Form_Activate()
Text1.SetFocus 'text1获得焦点
End Sub
Private Sub Form_Unload(Cancel As Integer)
Main.Enabled = True
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus '回车text2获得焦点
End Sub
Private Sub text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text3.SetFocus '回车text3获得焦点
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Command1.SetFocus '回车Command1获得焦点
End Sub
Private Sub Command1_Click()
'保存操作员及密码
If Text1.text <> "" Then
If Text2.text <> "" And Text3.text <> "" And Text2.text = Text3.text Then
adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
adoRs.Open "select * from tb_user", adocon, adOpenKeyset, adLockOptimistic
adoRs.AddNew
adoRs.Fields("操作员") = Text1.text
adoRs.Fields("密码") = Text2.text
adoRs.Update
adocon.Close
adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
adoRs.Open "select * from tb_qxsz", adocon, adOpenKeyset, adLockOptimistic
adoRs.AddNew
adoRs.Fields("操作员") = Text1.text
adoRs.Fields("密码") = Text2.text
adoRs.Update
adocon.Close
Text1.text = "": Text2.text = "": Text3.text = ""
MsgBox "操作员设置成功!", , "系统提示"
'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
ElseIf Text3.text = "" Then
MsgBox "请输入确认密码", , "系统提示"
Text3.SetFocus
ElseIf Text2.text <> Text3.text Then
MsgBox "两次输入的密码不相同", , "系统提示"
Text2.text = ""
Text3.text = ""
Text2.SetFocus
End If
Else
MsgBox "请输入操作员!", , "系统提示"
End If
End Sub
Private Sub Command2_Click()
Text1.text = "": Text2.text = "": Text3.text = ""
End Sub
Private Sub Command3_Click()
Main.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -