📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 0 'None
Caption = "Login ..."
ClientHeight = 4335
ClientLeft = 2505
ClientTop = 2505
ClientWidth = 6585
KeyPreview = -1 'True
LinkTopic = "Form1"
LockControls = -1 'True
ScaleHeight = 4335
ScaleMode = 0 'User
ScaleWidth = 6585
ShowInTaskbar = 0 'False
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 480
Top = 3360
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DASTGIR1"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DASTGIR1"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "user"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton BtnLogin
Appearance = 0 'Flat
BackColor = &H80000009&
Caption = "&Login ..."
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 2340
MaskColor = &H00FFFFFF&
Style = 1 'Graphical
TabIndex = 3
Top = 3510
Width = 1095
End
Begin VB.CommandButton BtnCancel
Appearance = 0 'Flat
BackColor = &H80000009&
Caption = "&Cancel"
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 3480
MaskColor = &H00FFFFFF&
Style = 1 'Graphical
TabIndex = 4
Top = 3510
Width = 1125
End
Begin VB.TextBox TxtPassword
Height = 330
IMEMode = 3 'DISABLE
Left = 2625
PasswordChar = "*"
TabIndex = 1
Top = 1785
Width = 2430
End
Begin VB.ComboBox Cmbusertype
Height = 315
Left = 2640
TabIndex = 2
Top = 2310
Width = 2415
End
Begin VB.TextBox TexUserID
Height = 330
Left = 2625
TabIndex = 0
Top = 1260
Width = 2430
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Password :"
BeginProperty Font
Name = "Arial"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000005&
Height = 270
Left = 1290
TabIndex = 7
Top = 1860
Width = 1320
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "User Type :"
BeginProperty Font
Name = "Arial"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000005&
Height = 270
Left = 1290
TabIndex = 6
Top = 2370
Width = 1320
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "User ID :"
BeginProperty Font
Name = "Arial"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000005&
Height = 270
Left = 1290
TabIndex = 5
Top = 1335
Width = 1305
End
Begin VB.Image Image1
Height = 4335
Left = 0
Stretch = -1 'True
Top = 0
Width = 6585
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub BtnCancel_Click()
VUserId = ""
VUsertype = ""
Login = False
End
End Sub
Private Sub BtnLogin_Click()
'On Error GoTo er
Dim RsLogin As New ADODB.Recordset
If rs.State = adStateOpen Then rs.Close
rs.Open "users", cnn, adOpenStatic, adLockReadOnly, adCmdTable
If rs.RecordCount = 0 Then
MsgBox "WELCOME PLZ First Create Account" & rs.RecordCount
frmnewuser.Show vbModal
Exit Sub
End If
If RsLogin.State = adStateOpen Then RsLogin.Close
RsLogin.Open "select * from users where UserId = '" & (TexUserID.Text) & "'", cnn, adOpenStatic, adLockReadOnly
If RsLogin.RecordCount = 0 Then
MsgBox "Invalid User Login ID.", vbExclamation + vbOKOnly, "Alert"
TexUserID.SetFocus
RsLogin.Close
Exit Sub
ElseIf RsLogin.RecordCount > 0 And RsLogin!Password <> (TxtPassword.Text) Then
MsgBox "Invalid User Login Password.", vbExclamation + vbOKOnly, "Alert"
TxtPassword.SetFocus
RsLogin.Close
Exit Sub
ElseIf RsLogin.RecordCount > 0 And RsLogin!Usertype <> Cmbusertype.Text Then
MsgBox "Invalid User Login Type.", vbExclamation + vbOKOnly, "Alert"
Cmbusertype.SetFocus
RsLogin.Close
Exit Sub
ElseIf (RsLogin.RecordCount > 0) And (RsLogin!Password = (TxtPassword.Text) And RsLogin!Usertype = Cmbusertype.Text) Then
VUsertype = RsLogin!Usertype
VUserId = RsLogin!Userid
Login = True
MsgBox TexUserID.Text & " has been successfully login.", vbInformation + vbOKOnly, "Confirmation"
RsLogin.Close
Unload Me
End If
Exit Sub
'er:
' MsgBox Err.Number & " " & Err.Description
End Sub
Private Sub Cmbusertype_KeyPress(KeyAscii As Integer)
If Cmbusertype.Text <> "" And KeyAscii = 13 Then
Call BtnLogin_Click
End If
End Sub
Private Sub Image1_Click()
End Sub
Private Sub TxtPassword_KeyPress(KeyAscii As Integer)
If (TexUserID.Text <> "" And TxtPassword.Text <> "") And (KeyAscii = 13 And Cmbusertype.Text <> "") Then
Call BtnLogin_Click
ElseIf TxtPassword.Text <> "" And KeyAscii = 13 Then
Cmbusertype.SetFocus
End If
End Sub
Private Sub TexUserid_KeyPress(KeyAscii As Integer)
If (TexUserID.Text <> "" And TxtPassword.Text <> "") And (KeyAscii = 13 And Cmbusertype.Text <> "") Then
Call BtnLogin_Click
ElseIf TexUserID.Text <> "" And KeyAscii = 13 Then
TxtPassword.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -