📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmLogin
Caption = "用户登陆"
ClientHeight = 2145
ClientLeft = 3450
ClientTop = 3270
ClientWidth = 4530
LinkTopic = "Form1"
ScaleHeight = 2145
ScaleWidth = 4530
Visible = 0 'False
Begin MSAdodcLib.Adodc AdodcLogin
Height = 330
Left = 1560
Top = 1320
Width = 1200
_ExtentX = 2117
_ExtentY = 582
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 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\student.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\student.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdodcLogin"
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 CmdCancel
Caption = "取消"
Height = 375
Left = 3120
TabIndex = 5
Top = 1440
Width = 1095
End
Begin VB.CommandButton CmdOK
Caption = "确定"
Height = 375
Left = 240
TabIndex = 4
Top = 1440
Width = 1095
End
Begin VB.TextBox TxtPassword
Height = 270
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 2
Top = 840
Width = 2535
End
Begin VB.TextBox TxtUserName
Height = 270
Left = 1800
TabIndex = 1
Top = 240
Width = 2535
End
Begin VB.Label LabPassword
Caption = "密码:"
Height = 255
Left = 240
TabIndex = 3
Top = 840
Width = 1215
End
Begin VB.Label LabUserName
Caption = "用户名:"
Height = 255
Left = 240
TabIndex = 0
Top = 240
Width = 1215
End
End
Attribute VB_Name = "FrmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SysUserName As String
Dim SysUserPwd As String
'窗体启动时的初始化代码
Private Sub Form_Load()
TxtPassword.Text = ""
TxtUserName.Text = ""
frmLogin.Show
'设置按钮及控件状态
TxtUserName.Enabled = True
TxtPassword.Enabled = True
CmdOK.Enabled = False
End Sub
'"确定"按钮添加代码
Private Sub cmdOK_Click()
SysUserName = TxtUserName.Text
SysUserPwd = TxtPassword.Text
AdodcLogin.CommandType = adCmdText
AdodcLogin.RecordSource = "Select * from User where id = "
AdodcLogin.Refresh
Dim irecordCount As Integer
irecordCount = AdodcLogin.Recordset.RecordCount
If irecordCount = 0 Then
MsgBox "对不起,没有这个用户名,请您重新输入", , "登录错误"
End If
End Sub
'"退出"按钮代码
Private Sub cmdCancel_Click()
End
End Sub
'用户登录名输入文本框状态改变事件代码
Private Sub TxtUserName_Change()
If TxtUserName.Text <> "" Then
'激活"确定"按钮
CmdOK.Enabled = True
'激活用户登录密码输入文本框
TxtPassword.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -