?? loginform.frm
字號:
VERSION 5.00
Begin VB.Form frmlogin
Caption = "登錄"
ClientHeight = 3120
ClientLeft = 60
ClientTop = 345
ClientWidth = 4560
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3120
ScaleWidth = 4560
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdcancel
Caption = "取 消"
Height = 375
Left = 2760
TabIndex = 6
Top = 2160
Width = 1095
End
Begin VB.CommandButton CmdOK
Caption = "登 錄"
Height = 375
Left = 1320
TabIndex = 5
Top = 2160
Width = 1095
End
Begin VB.TextBox txtPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 4
Top = 1560
Width = 2535
End
Begin VB.TextBox txtusername
Height = 375
Left = 1320
TabIndex = 3
Top = 960
Width = 2535
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "二000級04屆 畢業生:朱烽 設計"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000003&
Height = 375
Left = 240
TabIndex = 7
Top = 2760
Width = 4005
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "密碼:"
BeginProperty Font
Name = "宋體"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 2
Top = 1560
Width = 1095
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "用戶名:"
BeginProperty Font
Name = "宋體"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 1
Top = 960
Width = 1215
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "單位車輛管理系統"
BeginProperty Font
Name = "華文行楷"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000002&
Height = 495
Left = 240
TabIndex = 0
Top = 240
Width = 4215
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
Dim micount As Integer '用于記錄登陸次數
Private Sub cmdcancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdok_Click()
Dim txtsql As String '用于存放SQL語句
Dim mrc As ADODB.Recordset '存放記錄集對象
Dim msgtext As String '存放返回的信息
' Dim username As String
username = ""
password = ""
If Trim(txtusername.Text = "") Then
MsgBox "沒有這個用戶,請重新輸入用戶名!", vbOKOnly + vbExclamation, "警告"
txtusername.SetFocus
Else
txtsql = "select * from users where user_id='" & Trim(txtusername.Text) & " '"
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = True Then
MsgBox "沒有這個用戶,請重新輸入用戶名!", vbOKOnly + vbExclamation, "警告"
txtusername.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
OK = True
mrc.Close
Me.Hide
username = Trim(txtusername.Text)
password = Trim(txtPassword.Text)
Else
MsgBox "輸入密碼不正確,請重新輸入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
End Sub
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 txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
Private Sub txtusername_KeyDown(KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -