?? frmadduser.frm
字號:
VERSION 5.00
Begin VB.Form frmAdduser
Caption = "添加用戶"
ClientHeight = 3270
ClientLeft = 60
ClientTop = 345
ClientWidth = 4140
LinkTopic = "Form1"
ScaleHeight = 3270
ScaleWidth = 4140
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdCancel
Caption = "取 消"
Height = 375
Left = 2400
TabIndex = 4
Top = 2280
Width = 975
End
Begin VB.CommandButton cmdOK
Caption = "確 定"
Height = 375
Left = 840
TabIndex = 3
Top = 2280
Width = 975
End
Begin VB.TextBox txtPassword2
Height = 405
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 2
Top = 1320
Width = 1695
End
Begin VB.TextBox txtPassword1
Height = 405
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 1
Top = 840
Width = 1695
End
Begin VB.TextBox txtUserName
Height = 405
Left = 1800
TabIndex = 0
Top = 360
Width = 1695
End
Begin VB.Label Label3
Caption = " 請確認密碼:"
Height = 375
Left = 360
TabIndex = 7
Top = 1440
Width = 1455
End
Begin VB.Label Label2
Caption = " 請輸入密碼:"
Height = 255
Left = 360
TabIndex = 6
Top = 960
Width = 1455
End
Begin VB.Label Label1
Caption = "請輸入用戶名:"
Height = 255
Left = 480
TabIndex = 5
Top = 480
Width = 1335
End
End
Attribute VB_Name = "frmAdduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim txtsql As String
Dim mrc As ADODB.Recordset
Dim msgtext As String
If Trim(txtUserName.Text) = "" Then
MsgBox "請輸入用戶名稱!", vbOKOnly + vbExclamation, "警告"
Exit Sub
txtUserName.SetFocus
Else
txtsql = "select*from userinfo"
Set mrc = ExecuteSQL(txtsql, msgtext)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(txtUserName) Then
MsgBox "用戶已經存在,請重新輸入用戶名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
txtUserName.Text = ""
txtPassword1.Text = ""
txtPassword2.Text = ""
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If
If Trim(txtPassword1.Text) <> Trim(txtPassword2.Text) Then
MsgBox "兩次輸入密碼不一樣,請確認!", vbOKOnly + vbExclamation, "警告"
txtPassword1.SetFocus
txtPassword1.Text = ""
txtPassword2.Text = ""
Exit Sub
Else
If txtPassword1.Text = "" Then
MsgBox "密碼不能為空!", vbOKOnly + vbExclamation, "警告"
txtPassword1.SetFocus
txtPassword1.Text = ""
txtPassword2.Text = ""
Else
mrc.AddNew
mrc.Fields(0) = Trim(txtUserName.Text)
mrc.Fields(1) = Trim(txtPassword1.Text)
mrc.Update
mrc.Close
Me.Hide
MsgBox "添加用戶成功!", vbOKOnly + vbExclamation, "添加用戶"
End If
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -