📄 新用户注册.frm
字号:
VERSION 5.00
Begin VB.Form 新用户注册
BorderStyle = 1 'Fixed Single
Caption = "新用户注册"
ClientHeight = 3705
ClientLeft = 45
ClientTop = 435
ClientWidth = 3930
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3705
ScaleWidth = 3930
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text4
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 9
Top = 1680
Width = 1575
End
Begin VB.CommandButton Command3
Caption = "清空"
Height = 375
Left = 1680
TabIndex = 8
Top = 3000
Width = 735
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 7
Top = 3000
Width = 735
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 600
TabIndex = 6
Top = 3000
Width = 735
End
Begin VB.TextBox Text3
Height = 375
Left = 1800
TabIndex = 4
Top = 2280
Width = 1575
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 3
Top = 1080
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = 1800
TabIndex = 1
Top = 480
Width = 1575
End
Begin VB.Label Label4
Caption = "再次输入密码:"
Height = 375
Left = 240
TabIndex = 10
Top = 1800
Width = 1335
End
Begin VB.Label Label3
Caption = "用户姓名:"
Height = 255
Left = 600
TabIndex = 5
Top = 2400
Width = 975
End
Begin VB.Label Label2
Caption = "用户密码:"
Height = 255
Left = 600
TabIndex = 2
Top = 1200
Width = 1095
End
Begin VB.Label Label1
Caption = "用户ID:"
Height = 255
Left = 720
TabIndex = 0
Top = 600
Width = 975
End
End
Attribute VB_Name = "新用户注册"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Initial_Add()
Dim Rst As New ADODB.Recordset
Dim strSQL As String
Me.Text1.Text = ""
Me.Text2.Text = ""
Me.Text3.Text = ""
Me.Text4.Text = ""
End Sub
Private Sub Command1_Click()
SuppInfo_Add
End Sub
Private Sub Command3_Click()
Initial_Add
End Sub
Private Sub Form_Load()
Me.Command1.Default = True
Initial_Add
Exit Sub
End
End Sub
Private Function SuppInfo_Add() As Boolean
Dim Rst As New ADODB.Recordset
Dim strSQL As String
Dim intRst As Integer
SuppInfo_Add = False
If CheckFaceIsOk = False Then
Exit Function
End If
strSQL = "SELECT * FROM 登录 "
Rst.Open strSQL, cnnDatabase, adOpenDynamic, adLockOptimistic
If Me.Text2.Text = Me.Text4.Text Then
Rst.AddNew
Rst.Fields("用户ID").Value = Me.Text1.Text
Rst.Fields("密码").Value = Me.Text2.Text
Rst.Fields("用户名").Value = Me.Text3.Text
Rst.Update
MsgBox "添加新的用户信息成功!", vbInformation, "操作成功-"
Else
MsgBox "两次输入的密码不一致!", vbInformation, "错误-"
Me.Text2.Text = ""
Me.Text4.Text = ""
End If
Set Rst = Nothing
Initial_Add
SuppInfo_Add = False
Exit Function
End Function
Private Function CheckFaceIsOk() As Boolean
Dim intText As Integer
Dim strText As String
CheckFaceIsOk = True
If Me.Text1 = "" Then
MsgBox "用户ID不能为空!", vbCritical, Me.Caption
Me.Text1.SetFocus
CheckFaceIsOk = False
Exit Function
End If
If Me.Text2 = "" Then
MsgBox "用户密码不能为空!", vbCritical, Me.Caption
Me.Text2.SetFocus
CheckFaceIsOk = False
Exit Function
End If
If Me.Text3 = "" Then
MsgBox "用户姓名不能为空!", vbCritical, Me.Caption
Me.Text3.SetFocus
CheckFaceIsOk = False
Exit Function
End If
End Function
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -