📄 frmadduser.frm
字号:
VERSION 5.00
Begin VB.Form frmAddUser
Caption = "添加用户"
ClientHeight = 4020
ClientLeft = 60
ClientTop = 345
ClientWidth = 5340
LinkTopic = "Form1"
ScaleHeight = 4020
ScaleWidth = 5340
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 3600
TabIndex = 8
Top = 3240
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 7
Top = 3240
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 480
TabIndex = 6
Top = 3240
Width = 1215
End
Begin VB.TextBox txtpsw2
Height = 495
Left = 1680
TabIndex = 2
Top = 1920
Width = 2295
End
Begin VB.TextBox txtpsw1
Height = 495
Left = 1680
TabIndex = 1
Top = 1200
Width = 2295
End
Begin VB.TextBox txtname
Height = 495
Left = 1680
TabIndex = 0
Top = 480
Width = 2295
End
Begin VB.Label Label3
Caption = "重复输入密码"
Height = 495
Left = 480
TabIndex = 5
Top = 1920
Width = 1095
End
Begin VB.Label Label2
Caption = "密码"
Height = 495
Left = 480
TabIndex = 4
Top = 1200
Width = 1095
End
Begin VB.Label Label1
Caption = "用户名"
Height = 375
Left = 480
TabIndex = 3
Top = 600
Width = 1095
End
End
Attribute VB_Name = "frmAddUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
If txtname.Text = "" Then
MsgBox "请输入用户名"
txtname.SetFocus
Exit Sub
End If
If txtpsw1.Text <> txtpsw2.Text Then
MsgBox "两次输入的密码不一致,请重新输入"
txtpsw1.Text = ""
txtpsw2.Text = ""
txtpsw1.SetFocus
Exit Sub
End If
txtSQL = "select * from userinfo where username = '" & txtname.Text & "'"
'Set mrc = ExecuteSQL(txtSQL, MsgText)
'If mrc.RecordCount > 0 Then
On Error GoTo 1:
If Trim(mrc.Fields(0)) = txtname.Text Then
MsgBox "输入的用户名已经存在,请重新输入"
txtname.Text = ""
txtpsw1.Text = ""
txtpsw2.Text = ""
Else
1:
txtSQL = "insert into userinfo values ( '" & txtname.Text & "'" & ",'" & txtpsw1.Text & "')"
'Set mrc = ExecuteSQL(txtSQL, MsgText)
MsgBox MsgText
txtname.Text = ""
txtpsw1.Text = ""
txtpsw2.Text = ""
End If
End Sub
Private Sub Command2_Click()
txtname.Text = ""
txtpsw1.Text = ""
txtpsw2.Text = ""
End Sub
Private Sub Command3_Click()
Unload frmAddUser
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -