📄 frm_xtdl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_xtdl
BorderStyle = 0 'None
Caption = "系统登录"
ClientHeight = 3780
ClientLeft = 4200
ClientTop = 3000
ClientWidth = 5880
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frm_xtdl.frx":0000
ScaleHeight = 3780
ScaleWidth = 5880
ShowInTaskbar = 0 'False
Begin VB.ComboBox Cbx_Name
Height = 300
Left = 1590
TabIndex = 3
Text = "MR"
Top = 2370
Width = 1320
End
Begin VB.TextBox Txt_Password
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 285
IMEMode = 3 'DISABLE
Left = 3975
PasswordChar = "*"
TabIndex = 2
Top = 2370
Width = 1350
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 300
Top = 4185
Width = 2175
_ExtentX = 3836
_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 Cmd_Ok
Caption = "确定"
Height = 320
Left = 3540
TabIndex = 0
Top = 2925
Width = 875
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 320
Left = 4575
TabIndex = 1
Top = 2925
Width = 875
End
End
Attribute VB_Name = "frm_xtdl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem '定义一个ListItem对象
Dim key As String '定义字符串变量
Private Sub Cmd_Cancel_Click()
End
End Sub
'用户登录按钮的事件代码
Private Sub Cmd_Ok_Click()
Dim MPassword As String
If Cbx_Name.Text = "MR" And Txt_Password.Text = "mingrisoft" Then '判断是否使用的是超级口令登录
Frm_Main.StatusBar1.Panels.Item(2).Text = "当前操作员: MR"
Name1 = Cbx_Name.Text '将操作员姓名信息赋予全局变量Name1
Unload Me
Frm_Main.Show '显示系统主窗体
Else
Adodc1.RecordSource = "select * from tb_user where user_name ='" & Cbx_Name.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MPassword = Adodc1.Recordset.Fields("user_mm")
If Txt_Password.Text = MPassword Then '判断数据的密码是否正确
Name1 = Cbx_Name.Text
Frm_Main.StatusBar1.Panels.Item(2).Text = "当前操作员: " + Adodc1.Recordset.Fields("user_name")
Frm_Main.Show '通过身份验证则显示主窗体,登录到系统当中
Unload Me
Else
MsgBox "密码不正确,请您确认后重新输入", , "提示信息"
Txt_Password.Text = ""
Txt_Password.SetFocus
End If
Else
MsgBox "对不起 没有此用户的信息", , "提示信息"
Cbx_Name.Text = ""
Txt_Password.Text = ""
End If
End If
End Sub
Private Sub Form_Load()
Call WHScreen '调用获取屏幕分辨率的过程函数
'使用代码连接数据库与数据表
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_user"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Cbx_Name.Clear '在添加数据时,首先清空控件中的内容
Do While Adodc1.Recordset.EOF = False '将操作员信息添加到ListView控件当中
Cbx_Name.AddItem (Adodc1.Recordset.Fields("user_name"))
Adodc1.Recordset.MoveNext
Loop
End If
If TWidth <= 800 Or THeigth <= 600 Then '判断屏幕分辨率的大小
Exit Sub
Else
ChangeScreen '调整屏幕分辨率
End If
End Sub
Private Sub Label3_Click()
End Sub
Private Sub Txt_Password_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Cmd_Ok_Click '调用确定按钮的单击事件代码
End If
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Txt_Password.SetFocus
End If
End Sub
Private Sub ChangeScreen() '改变屏幕分辨率函数
MsgBox "您桌面的分辨率并不是800*600,建议您将桌面的分辨率调整成800*600之后,再运行此程序!", 64, "提示信息"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -