📄 frmadminadd.frm
字号:
VERSION 5.00
Begin VB.Form FrmAdminAdd
Caption = "用户登记"
ClientHeight = 2460
ClientLeft = 60
ClientTop = 345
ClientWidth = 3855
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 2460
ScaleWidth = 3855
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access 2000;"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 3120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 360
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton Command2
Caption = "关闭"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2280
TabIndex = 7
Top = 1800
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 6
Top = 1800
Width = 1215
End
Begin VB.TextBox Text3
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 5
Top = 1200
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 4
Top = 600
Width = 1215
End
Begin VB.TextBox Text1
Height = 375
Left = 1920
TabIndex = 3
Top = 120
Width = 1215
End
Begin VB.Label Label3
Caption = "确认码"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 2
Top = 1200
Width = 855
End
Begin VB.Label Label2
Caption = "密 码"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 1
Top = 600
Width = 855
End
Begin VB.Label Label1
Caption = "用户名"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 0
Top = 120
Width = 855
End
End
Attribute VB_Name = "FrmAdminAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo err
If Text1.Text = "" Then '用户名是空时
MsgBox "用户名不能为空", vbOKOnly + vbCritical, "系统提示"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then '密码是空时
MsgBox "密码不能为空", vbOKOnly + vbCritical, "系统提示"
Text2.SetFocus
Exit Sub
Else
End If
If Text2.Text <> Text3.Text Then
MsgBox "两次输入的密码不一样", vbOKOnly + vbCritical, "系统提示"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Exit Sub
End If
'***************************
Data1.Recordset.addnew
Data1.Recordset.Fields("id") = Text1.Text
Data1.Recordset.Fields("pwd") = Text2.Text
Data1.Recordset.Update
Data1.Recordset.Close
MsgBox "添加成功", vbOKOnly + vbInformation, "系统提示"
Unload Me
FrmMdi.mnuuseradd.Checked = False
err:
If err.Number = 3022 Then
MsgBox "数据重复!", vbOKOnly + vbCritical, "系统提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
FrmMdi.mnuuseradd.Checked = False
End Sub
Private Sub Form_Load()
Me.Height = 2865
Me.Width = 3975
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Data1.DatabaseName = App.Path & "\message"
Data1.RecordSource = "admin"
End Sub
Private Sub Form_Unload(Cancel As Integer)
FrmMdi.mnuuseradd.Checked = False
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -