📄 frm_adduser.frm
字号:
VERSION 5.00
Begin VB.Form Frm_addUser
Caption = "添加用户"
ClientHeight = 3885
ClientLeft = 60
ClientTop = 375
ClientWidth = 4680
LinkTopic = "Form2"
ScaleHeight = 3885
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 2400
TabIndex = 13
Top = 3000
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 840
TabIndex = 12
Top = 3000
Width = 1215
End
Begin VB.Frame Frame1
Height = 2415
Left = 600
TabIndex = 0
Top = 360
Width = 3255
Begin VB.OptionButton Option2
Caption = "Option2"
Height = 255
Left = 2160
TabIndex = 9
Top = 1920
Width = 135
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 180
Left = 1200
TabIndex = 8
Top = 1920
Width = 255
End
Begin VB.TextBox txtSurePwd
Height = 375
Left = 1200
TabIndex = 7
Top = 1320
Width = 1455
End
Begin VB.TextBox txtPwd
Height = 375
Left = 1200
TabIndex = 6
Top = 840
Width = 1455
End
Begin VB.TextBox txtUser
Height = 375
Left = 1200
TabIndex = 5
Top = 240
Width = 1455
End
Begin VB.Label Label6
Caption = "普通用户"
Height = 375
Left = 2400
TabIndex = 11
Top = 1920
Width = 735
End
Begin VB.Label Label5
Caption = "管理员"
Height = 375
Left = 1440
TabIndex = 10
Top = 1920
Width = 615
End
Begin VB.Label Label4
Caption = "用户类型"
Height = 375
Left = 240
TabIndex = 4
Top = 1920
Width = 855
End
Begin VB.Label Label3
Caption = "确认密码"
Height = 375
Left = 240
TabIndex = 3
Top = 1440
Width = 975
End
Begin VB.Label Label2
Caption = "密码"
Height = 255
Left = 240
TabIndex = 2
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "用户名"
Height = 375
Left = 240
TabIndex = 1
Top = 360
Width = 735
End
End
End
Attribute VB_Name = "frm_addUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim UserType As Integer
If txtUser = "" Then
MsgBox " 请输入用户名"
txtUser.SetFocus
Exit Sub
End If
Adodcl.RecordSource = "select * from Users where User_name'" + Trim(txtUser.Text) + "'"
Adodcl.Refresh
If Adodcl.Recordset.EOF = True Then
MsgBox " 用户名已存在,请重新输入"
txtUser.SetFocus
Exit Sub
Else
If txtPwd = "" Then
MsgBox " 请输入密码"
txtPwd.SetFocus
Exit Sub
End If
If txtSurePwd = "" Then
MsgBox " 请确认密码"
txtSurePwd.SetFocus
Exit Sub
End If
If Option1 = True Then
UserType = 0
ElseIf Option2 = True Then
UserType = 1
Else
MsgBox " 请选择用户类型"
Exit Sub
End If
If txtPwd <> txtSurePwd Then
MsgBox " 密码和确认密码不相同,请重新确认"
txtSurePwd.SetFocus
txtSurePwd.SelStart = 0
txtSurePwd.SelLength = Len(txtSurePwd)
Exit Sub
End If
Adodcl.Recordset.AddNew
Adodcl.Recordset.Fields(0).Value = Trim(txtUser.Text)
Adodcl.Recordset.Fields(1).Value = Trim(txtPwd.Text)
Adodcl.Recordset.Fields(2).Value = UserType
Adodcl.Recordset.Update
Adodcl.Refresh
MsgBox " 用户添加完成"
Unload Me
End If
End Sub
Private Sub Command2_Click()
Load FormMain
FormMain.Show
Me.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -