📄 frmadduser.frm
字号:
VERSION 5.00
Begin VB.Form frmadduser
Caption = "添加用户"
ClientHeight = 3945
ClientLeft = 60
ClientTop = 345
ClientWidth = 4350
LinkTopic = "Form1"
ScaleHeight = 3945
ScaleWidth = 4350
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdcancel
Caption = "取 消"
Height = 330
Left = 2475
TabIndex = 8
Top = 3390
Width = 1050
End
Begin VB.CommandButton cmdok
Caption = "确 定"
Height = 330
Left = 495
TabIndex = 7
Top = 3390
Width = 1050
End
Begin VB.Frame Frame1
Height = 2670
Left = 75
TabIndex = 0
Top = 180
Width = 4185
Begin VB.TextBox text1
Height = 360
IMEMode = 3 'DISABLE
Index = 2
Left = 1470
PasswordChar = "*"
TabIndex = 6
Top = 1800
Width = 2400
End
Begin VB.TextBox text1
Height = 360
IMEMode = 3 'DISABLE
Index = 1
Left = 1500
PasswordChar = "*"
TabIndex = 5
Top = 1050
Width = 2400
End
Begin VB.TextBox text1
Height = 360
Index = 0
Left = 1500
TabIndex = 4
Top = 315
Width = 2400
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 = 360
Left = 195
TabIndex = 3
Top = 1845
Width = 1335
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 = 405
Left = 195
TabIndex = 2
Top = 1110
Width = 1155
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 = 225
Left = 60
TabIndex = 1
Top = 390
Width = 1395
End
End
Begin VB.Line Line2
X1 = -90
X2 = 4305
Y1 = 3075
Y2 = 3075
End
Begin VB.Line Line1
BorderColor = &H80000005&
BorderWidth = 3
X1 = 30
X2 = 4380
Y1 = 3075
Y2 = 3075
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(Text1(0).Text) = "" Then
MsgBox "请输入用户名!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Text1(0).SetFocus
Else
txtSQL = "select * from userpwd"
Set mrc = ExecuteSQL(txtSQL, MsgText)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(Text1(0)) Then
MsgBox "用户已经存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
Text1(0).SetFocus
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If
'判断两次密码是否一致
If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
Text1(1).SetFocus
Text1(1).Text = ""
Text1(2).Text = ""
Exit Sub
Else
'判断两次密码是否为空
If Text1(1).Text = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
Text1(1).SetFocus
Text1(1).Text = ""
Text1(2).Text = ""
Else
'添加新记录
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0).Text)
mrc.Fields(1) = Trim(Text1(1).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 + -