📄 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 + -