form2.frm
来自「一个商业软件的源码」· FRM 代码 · 共 389 行
FRM
389 行
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{69958DD9-23E5-11D6-ACD7-0050BAC05F28}#12.0#0"; "CurtButton.ocx"
Begin VB.Form Form2
BackColor = &H00FFC0FF&
BorderStyle = 1 'Fixed Single
Caption = "登录"
ClientHeight = 1935
ClientLeft = 45
ClientTop = 435
ClientWidth = 3420
Icon = "Form2.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1935
ScaleWidth = 3420
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
BackColor = &H00FFC0FF&
Height = 495
Left = 120
TabIndex = 8
Top = 1440
Width = 3255
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 180
Left = 120
TabIndex = 12
Top = 240
Visible = 0 'False
Width = 495
End
Begin CurtButton多风格按钮控件.CurtButton CurtButton3
Height = 255
Left = 2040
TabIndex = 11
Top = 120
Visible = 0 'False
Width = 1095
_ExtentX = 1931
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Picture = "Form2.frx":030A
Caption = "注册用户(&E)"
End
Begin CurtButton多风格按钮控件.CurtButton CurtButton2
Height = 255
Left = 2040
TabIndex = 9
Top = 120
Width = 1095
_ExtentX = 1931
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Picture = "Form2.frx":0326
Caption = "添加用户(&A)"
End
Begin CurtButton多风格按钮控件.CurtButton CurtButton1
Height = 255
Left = 600
TabIndex = 10
Top = 120
Width = 1095
_ExtentX = 1931
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Picture = "Form2.frx":0342
Caption = "登录(&OK)"
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 240
Top = 1440
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 582
ConnectMode = 3
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 4
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.Frame Frame1
BackColor = &H00FFC0FF&
Height = 1455
Left = 120
TabIndex = 1
Top = 0
Width = 3255
Begin VB.TextBox Text3
Height = 375
IMEMode = 3 'DISABLE
Left = 960
PasswordChar = "*"
TabIndex = 7
Top = 600
Width = 2175
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 960
TabIndex = 0
Top = 120
Width = 2175
End
Begin VB.CheckBox Check1
BackColor = &H00FFC0FF&
Height = 255
Left = 960
TabIndex = 5
Top = 1080
Width = 255
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "口令区分大小写"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1440
TabIndex = 6
Top = 1080
Width = 1695
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "更改口令"
Height = 255
Left = 120
TabIndex = 4
Top = 1080
Width = 735
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "口令"
Height = 375
Left = 120
TabIndex = 3
Top = 600
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名"
Height = 375
Left = 120
TabIndex = 2
Top = 240
Width = 1095
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim J As Integer
Private Sub Command1_Click()
Adodc1.Recordset.Delete
Adodc1.Recordset.UpdateBatch
End Sub
Private Sub CurtButton1_Click()
USEPASSWORD = Text3.Text
users = Text2.Text
Adodc1.RecordSource = "select * from users where 用户ID=" & "'" & Text2.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "用户ID或用户密码有误!"
J = J + 1
If J = 3 Then
MsgBox "你已三次输入错误密码,再见!"
Unload Me
End If
Else
If Text2.Text = Adodc1.Recordset.Fields(0).Value And Text3.Text = Adodc1.Recordset.Fields(1).Value Then
If Check1.Value = 1 Then
Me.Hide
edit.Show
Else
Form1.Show
Unload Me
End If
Else
J = J + 1
If J = 3 Then
MsgBox "你已三次输入错误密码,再见!"
cnnado.Close
Unload Me
Exit Sub
End If
Text2.Text = ""
Text3.Text = ""
MsgBox "你输入密码有误,请重新输入"
End If
End If
End Sub
Private Sub CurtButton2_Click()
If Text2.Text = "" Then
MsgBox "请输入系统管理员ID和密码!"
End If
Adodc1.RecordSource = "select * from users where 用户身份='admin'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
J = J + 1
If J = 3 Then
MsgBox "你已三次输入错误密码,再见!"
cnn.Close
Unload Me
End If
Else
If Text2.Text = Adodc1.Recordset.Fields(0).Value And Text3.Text = Adodc1.Recordset.Fields(1).Value Then
Me.Hide
Form3.Show
Text2.Text = ""
Text3.Text = ""
Else
J = J + 1
If J = 3 Then
MsgBox "你已三次输入错误密码,再见!"
Unload Me
End If
End If
End If
End Sub
Private Sub CurtButton3_Click()
Form3.Show
End Sub
Private Sub Form_Load()
If App.PrevInstance = True Then
MsgBox "程序正在运行,请检查窗口是否被最小化。", 64 + 256, "友情提示!"
Unload Me
Else
Call dataopen
Adodc1.ConnectionString = cnnado.ConnectionString
Adodc1.RecordSource = "select * from usn"
Adodc1.Refresh
Text2.Text = ""
Text3.Text = ""
If Adodc1.Recordset.EOF Then
MsgBox "您没有注册用户,请先注册。", vbOKOnly
CurtButton1.Enabled = False
CurtButton3.Visible = True
CurtButton2.Visible = False
End If
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
USEPASSWORD = Text3.Text
users = Text2.Text
Adodc1.RecordSource = "select * from usn where USERNAME=" & "'" & Text2.Text & "'"
Adodc1.Refresh
If KeyCode = 13 Then
If Text2.Text = Adodc1.Recordset.Fields(0).Value And Text3.Text = Adodc1.Recordset.Fields(1).Value Then
If Check1.Value = 1 Then
Me.Hide
edit.Show
Else
Form4.Show
Unload Me
End If
Else
J = J + 1
If J = 3 Then
MsgBox "你已三次输入错误密码,再见!"
cnnado.Close
Unload Me
Exit Sub
End If
MsgBox "你输入密码有误,请重新输入"
Text3.Text = ""
End If
End If
End Sub
Private Sub Text2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
MsgBox "为了数据安全已屏蔽右键"
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?