📄 添加用户窗口.frm
字号:
VERSION 5.00
Begin VB.Form adduser
Caption = "添加用户窗口"
ClientHeight = 5235
ClientLeft = 4185
ClientTop = 3615
ClientWidth = 6645
LinkTopic = "Form1"
ScaleHeight = 5235
ScaleWidth = 6645
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3240
TabIndex = 7
Top = 3120
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 960
TabIndex = 6
Top = 3120
Width = 1335
End
Begin VB.TextBox Text3
Height = 375
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 5
Top = 1680
Width = 1695
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 4
Top = 1080
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 2520
TabIndex = 3
Top = 480
Width = 1695
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 = 1200
TabIndex = 2
Top = 1800
Width = 1455
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 = 495
Left = 1200
TabIndex = 1
Top = 1200
Width = 1455
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 = 1200
TabIndex = 0
Top = 600
Width = 1455
End
End
Attribute VB_Name = "adduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim NewUser As String
Dim NewPwd As String
Dim NewPwd1 As String
NewUser = Trim$(Text1.Text)
NewPwd = Trim$(Text2.Text)
NewPwd1 = Trim$(Text3.Text)
If NewUser = "" Then
MsgBox "登陆帐号不能为空,请输入登陆帐号!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
End If
If NewPwd = "" Then
MsgBox "登陆密码不能为空,请输入登陆密码!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Exit Sub
End If
If NewPwd1 = "" Then
MsgBox "密码确认不能为空,请输入密码确认!", vbOKOnly + vbExclamation, "警告"
Text3.SetFocus
Exit Sub
End If
If NewPwd <> NewPwd1 Then
MsgBox "登陆密码和密码确认不一致,请重新输入登陆密码和密码确认!", vbOKOnly + vbExclamation, "警告"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Exit Sub
End If
Dim rs As ADODB.Recordset
txtSQL = "select * from muser where user_name='" & NewUser & "'"
Set rs = ExecuteSQL(txtSQL, txtmsg)
If rs.EOF = False Then
MsgBox "登陆帐号已经存在,请重新输入登陆帐号!", vbOKOnly + vbExclamation, "警告"
Text1.Text = ""
Text1.SetFocus
Exit Sub
Else
txtSQL = "insert into muser(user_name,user_pwd) values('" & NewUser & "','" & NewPwd & "')"
Set rs = ExecuteSQL(txtSQL, txtmsg)
MsgBox "用户添加成功!", vbOKOnly + vbExclamation, "警告"
Me.Hide
Unload adduser
End If
Set rs = Nothing
End Sub
Private Sub Command2_Click()
Me.Hide
Unload adduser
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -