📄 frmadduser.frm
字号:
VERSION 5.00
Begin VB.Form frmAdduser
BorderStyle = 1 'Fixed Single
Caption = "添加用户"
ClientHeight = 3195
ClientLeft = 45
ClientTop = 330
ClientWidth = 4575
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4575
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdCancel
Caption = "取消(&X)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2760
TabIndex = 7
Top = 2520
Width = 1095
End
Begin VB.CommandButton cmdOK
Caption = "确认(&O)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 6
Top = 2520
Width = 1095
End
Begin VB.TextBox txtPassword2
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 5
Top = 1800
Width = 1935
End
Begin VB.TextBox txtPassword1
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 4
Top = 1080
Width = 1935
End
Begin VB.TextBox txtUserName
Height = 375
Left = 1920
TabIndex = 3
Top = 360
Width = 1935
End
Begin VB.Label Label3
Caption = "请确认密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 2
Top = 1920
Width = 1215
End
Begin VB.Label Label2
Caption = "请输入密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 1
Top = 1200
Width = 1215
End
Begin VB.Label Label1
Caption = "请输入用户名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 0
Top = 480
Width = 1455
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 user_Info "
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 + -