?? frmlogin.frm
字號(hào):
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登錄"
ClientHeight = 3525
ClientLeft = 30
ClientTop = 330
ClientWidth = 5370
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmLogin.frx":0000
ScaleHeight = 3525
ScaleWidth = 5370
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Tag = "Login"
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 480
Left = 3000
TabIndex = 4
Tag = "Cancel"
Top = 2640
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "確定"
Default = -1 'True
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 480
Left = 960
TabIndex = 3
Tag = "OK"
Top = 2640
Width = 1140
End
Begin VB.TextBox txtPassword
Height = 525
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 2
Top = 1680
Width = 2325
End
Begin VB.TextBox txtUserName
Height = 525
Left = 1920
TabIndex = 1
Top = 840
Width = 2325
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "學(xué)籍管理系統(tǒng)"
BeginProperty Font
Name = "華文彩云"
Size = 22.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000002&
Height = 615
Left = 1200
TabIndex = 6
Top = 240
Width = 3015
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 = 375
Index = 1
Left = 480
TabIndex = 0
Top = 1680
Width = 1080
End
Begin VB.Label lblLabels
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 = 375
Index = 0
Left = 600
TabIndex = 5
Tag = "&User Name:"
Top = 960
Width = 840
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 Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
'記錄確定次數(shù)
Dim miCount As Integer
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
If lSize > 0 Then
txtUserName.Text = ""
Else
txtUserName.Text = vbNullString
End If
OK = False
miCount = 0
End Sub
Private Sub cmdCancel_Click()
OK = False
Me.Hide
Form1.Show
End Sub
Private Sub cmdOK_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
'ToDo: create test for correct password
'check for correct password
UserName = ""
If Trim(txtUserName.Text = "") Then
MsgBox "沒有這個(gè)用戶,請(qǐng)重新輸入用戶名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtSQL = "select * from user_Info where user_ID = '" & txtUserName.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "沒有這個(gè)用戶,請(qǐng)重新輸入用戶名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
OK = True
mrc.Close
frmMain.Show
Me.Hide
UserName = Trim(txtUserName.Text)
Else
MsgBox "輸入密碼不正確,請(qǐng)重新輸入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
miCount = miCount + 1
If miCount = 3 Then
Me.Hide
End If
Exit Sub
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -