📄 frmadduser.frm
字号:
VERSION 5.00
Begin VB.Form frmAdduser
BorderStyle = 3 'Fixed Dialog
Caption = "Add New User"
ClientHeight = 3210
ClientLeft = 45
ClientTop = 435
ClientWidth = 4935
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3210
ScaleWidth = 4935
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 495
Left = 2760
TabIndex = 7
Top = 2520
Width = 1335
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Height = 495
Left = 720
TabIndex = 6
Top = 2520
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
IMEMode = 3 'DISABLE
Index = 2
Left = 2400
MaxLength = 50
PasswordChar = "*"
TabIndex = 5
Top = 1920
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
IMEMode = 3 'DISABLE
Index = 1
Left = 2400
MaxLength = 50
PasswordChar = "*"
TabIndex = 4
Top = 1200
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Index = 0
Left = 2400
MaxLength = 50
TabIndex = 3
Top = 360
Width = 2055
End
Begin VB.Label Label3
Caption = "Confirm Password:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 495
Left = 120
TabIndex = 2
Top = 1920
Width = 2655
End
Begin VB.Label Label2
Caption = "Password:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 495
Left = 960
TabIndex = 1
Top = 1200
Width = 1455
End
Begin VB.Label Label1
Caption = "New User Name:"
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 495
Left = 480
TabIndex = 0
Top = 360
Width = 1695
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 UserTable "
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 + -