📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "系统登陆"
ClientHeight = 2475
ClientLeft = 30
ClientTop = 330
ClientWidth = 4785
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2475
ScaleWidth = 4785
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Tag = "Login"
Begin VB.ComboBox cbUserName
Appearance = 0 'Flat
Height = 300
Left = 1800
Style = 2 'Dropdown List
TabIndex = 6
Top = 960
Width = 2295
End
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 360
Left = 2580
TabIndex = 4
Tag = "Cancel"
Top = 1860
Width = 1140
End
Begin VB.CommandButton cmdOK
BackColor = &H80000007&
Caption = "OK"
Default = -1 'True
Height = 360
Left = 960
TabIndex = 1
Tag = "OK"
Top = 1860
Width = 1140
End
Begin VB.TextBox txtPassword
Appearance = 0 'Flat
BackColor = &H80000009&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 288
IMEMode = 3 'DISABLE
Left = 1788
PasswordChar = "*"
TabIndex = 0
Top = 1365
Width = 2325
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFFFFF&
BackStyle = 0 'Transparent
Caption = "贸易信息管理系统"
BeginProperty Font
Name = "楷体_GB2312"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 435
Left = 480
TabIndex = 5
Top = 240
Width = 3720
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 600
TabIndex = 2
Tag = "&Password:"
Top = 1380
Width = 840
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 585
TabIndex = 3
Tag = "&User Name:"
Top = 990
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public LoginSucceeded As Boolean
Private Sub cmdCancel_Click()
'设置全局变量为 false
'不提示失败的登录
LoginSucceeded = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
Dim txtsql As String
Dim mrc As ADODB.Recordset
Dim Msgtext As String
txtsql = "select * from user_info where user_name='" & Me.cbUserName.Text & "'"
Set mrc = ExecuteSQL(txtsql, Msgtext)
UserName = ""
If Trim(Me.cbUserName.Text = "") Then
MsgBox "请重新选择用户名!", vbOKOnly + vbExclamation
Me.cbUserName.SetFocus
Else
If Trim(mrc.Fields(2)) = Trim(Me.txtPassword.Text) Then
LoginSucceeded = True
mrc.Close
Me.Hide
UserName = Trim(Me.cbUserName.Text)
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation
Me.txtPassword.SetFocus
Me.txtPassword.Text = ""
End If
End If
End Sub
Private Sub Form_Load()
ServerName = GetKey(App.Path + "\Setup.ini", "Server Name")
DataBase = GetKey(App.Path + "\Setup.ini", "Data Base")
UserID = GetKey(App.Path + "\setup.ini", "User Id")
UserPsw = GetKey(App.Path + "\setup.ini", "User Psw")
If ServerName = "" And UserID = "" And UserPsw = "" Then
MsgBox "Setup.ini格式不正确,请重新设置"
End
End If
cbUserName.Clear
Dim txtsql As String
Dim Msgtext As String
Dim mrc As ADODB.Recordset
txtsql = "select * from user_info"
Set mrc = ExecuteSQL(txtsql, Msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cbUserName.AddItem Trim(mrc.Fields(1))
mrc.MoveNext
Loop
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -