📄 frmadduser.frm
字号:
VERSION 5.00
Begin VB.Form frmAdduser
BackColor = &H00C0C0FF&
Caption = "添加用户"
ClientHeight = 3015
ClientLeft = 3000
ClientTop = 3045
ClientWidth = 5145
LinkTopic = "Form1"
ScaleHeight = 3015
ScaleWidth = 5145
Begin VB.TextBox txtUserName
Height = 375
Left = 1920
TabIndex = 7
Top = 240
Width = 2655
End
Begin VB.CommandButton cmdCancel
BackColor = &H00C0C0FF&
Caption = "取消"
Height = 495
Left = 3120
Style = 1 'Graphical
TabIndex = 6
Top = 2280
Width = 1215
End
Begin VB.CommandButton cmdOK
BackColor = &H00C0C0FF&
Caption = "确定"
Height = 495
Left = 960
MaskColor = &H00C0FFFF&
Style = 1 'Graphical
TabIndex = 5
Top = 2280
Width = 1215
End
Begin VB.TextBox txtPassword2
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 4
Top = 1440
Width = 2655
End
Begin VB.TextBox txtPassword1
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 3
Top = 840
Width = 2655
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请输入用户名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 255
Index = 0
Left = 240
TabIndex = 2
Top = 240
Width = 1335
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请确认密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 255
Index = 2
Left = 240
TabIndex = 1
Top = 1440
Width = 1335
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请输入密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 255
Index = 1
Left = 240
TabIndex = 0
Top = 840
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 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 txtUserName.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
Private Sub Form_Load()
'frmAdduser.txtUserName.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -