📄 useradd.frm
字号:
VERSION 5.00
Begin VB.Form useradd
AutoRedraw = -1 'True
Caption = "添加新用户"
ClientHeight = 3060
ClientLeft = 4455
ClientTop = 3900
ClientWidth = 4350
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 3060
ScaleWidth = 4350
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2520
TabIndex = 5
Top = 2400
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Default = -1 'True
Height = 375
Left = 840
TabIndex = 4
Top = 2400
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
IMEMode = 3 'DISABLE
Index = 2
Left = 1680
PasswordChar = "*"
TabIndex = 3
Top = 1560
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
IMEMode = 3 'DISABLE
Index = 1
Left = 1680
PasswordChar = "*"
TabIndex = 2
Top = 840
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
Index = 0
Left = 1680
TabIndex = 1
Top = 120
Width = 2295
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "请确认您的密码:"
Height = 180
Left = 240
TabIndex = 7
Top = 1680
Width = 1440
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "请输入您的密码:"
Height = 180
Left = 240
TabIndex = 6
Top = 960
Width = 1440
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请输入用户名:"
Height = 180
Left = 240
TabIndex = 0
Top = 240
Width = 1260
End
End
Attribute VB_Name = "useradd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command1_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 user_if "
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
MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户"
Me.Text1(0).Text = ""
Me.Text1(1).Text = ""
Me.Text1(2).Text = ""
Me.Text1(0).SetFocus
Me.Hide
End If
End If
End Sub
Private Sub Form_Load()
Me.Top = 0
Me.Height = 3500
Me.Left = 0
Me.Width = 4500
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -