📄 form9.frm
字号:
VERSION 5.00
Begin VB.Form frmtjyh
BackColor = &H00E0E0E0&
Caption = "新用户注册"
ClientHeight = 5445
ClientLeft = 60
ClientTop = 450
ClientWidth = 5445
LinkTopic = "Form9"
ScaleHeight = 5445
ScaleWidth = 5445
Begin VB.CommandButton Command2
Caption = "关 闭"
Height = 495
Left = 3120
TabIndex = 12
Top = 4560
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "注 册"
Height = 495
Left = 960
TabIndex = 11
Top = 4560
Width = 1215
End
Begin VB.Frame Frame1
BackColor = &H00E0E0E0&
Height = 3735
Left = 600
TabIndex = 0
Top = 360
Width = 4215
Begin VB.TextBox txtRTime
Height = 375
Left = 1800
TabIndex = 5
Top = 2880
Width = 1935
End
Begin VB.TextBox txtTUser
Height = 375
Left = 1800
TabIndex = 4
Top = 2280
Width = 1935
End
Begin VB.TextBox txtRPwd
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 3
Top = 1680
Width = 1935
End
Begin VB.TextBox txtPwd
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 2
Top = 1080
Width = 1935
End
Begin VB.TextBox txtUser
Height = 375
Left = 1800
TabIndex = 1
Top = 480
Width = 1935
End
Begin VB.Label Label5
BackColor = &H00E0E0E0&
Caption = "注册时间:"
Height = 255
Left = 720
TabIndex = 10
Top = 3000
Width = 975
End
Begin VB.Label Label4
BackColor = &H00E0E0E0&
Caption = "真实姓名:"
Height = 255
Left = 720
TabIndex = 9
Top = 2400
Width = 975
End
Begin VB.Label Label3
BackColor = &H00E0E0E0&
Caption = "确定密码:"
Height = 255
Left = 720
TabIndex = 8
Top = 1800
Width = 1095
End
Begin VB.Label Label2
BackColor = &H00E0E0E0&
Caption = "密 码:"
Height = 255
Left = 720
TabIndex = 7
Top = 1200
Width = 975
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "用 户 名:"
Height = 255
Left = 720
TabIndex = 6
Top = 600
Width = 975
End
End
End
Attribute VB_Name = "frmtjyh"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If txtUser.Text = "" Then
MsgBox "请输入用户名!", vbOKOnly + vbInformation, "注意"
txtUser.SetFocus
Exit Sub
Else
If txtPwd.Text = "" Then
MsgBox "请输入密码!", vbOKOnly + vbInformation, "注意"
txtPwd.SetFocus
Exit Sub
Else
If txtRPwd.Text = "" Then
MsgBox "请再次输入密码!", vbOKOnly + vbInformation, "注意"
txtRPwd.SetFocus
Exit Sub
Else
If txtTUser.Text = "" Then
MsgBox "请输你的真实姓名!", vbOKOnly + vbInformation, "注意"
txtTUser.SetFocus
Exit Sub
End If
If txtPwd.Text <> txtRPwd.Text Then
MsgBox "两次输入的密码不同,请重新输入密码!", vbOKOnly + vbInformation, "注意"
txtPwd.Text = ""
txtRPwd.Text = ""
txtPwd.SetFocus
Exit Sub
End If
Dim rs_check As New ADODB.Recordset
Dim rs_add As New ADODB.Recordset
Dim MsgText As String
Dim strsql As String
strsql = "select * from UserTable where userId='" & txtUser.Text & "'"
Set rs_check = ExecuteSQL(strsql, MsgText)
If rs_check.EOF = False Then
MsgBox "此用户名已存在,请选择其他用户!", vbOKOnly + vbInformation, "注意"
txtUser.Text = ""
txtUser.SetFocus
rs_check.Close
Exit Sub
End If
Dim sqladd As String
sqladd = "select * from UserTable"
Set rs_add = ExecuteSQL(sqladd, MsgText)
rs_add.AddNew
rs_add.Fields(0) = txtUser.Text
rs_add.Fields(1) = txtPwd.Text
rs_add.Fields(2) = txtTUser.Text
rs_add.Fields(3) = txtRTime.Text
rs_add.Update
MsgBox "新用户已注册成功!", vbOKOnly + vbInformation, "注意"
rs_check.Close
rs_add.Close
Unload Me
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
frmtjyh.Width = 5565
frmtjyh.Height = 5850
Dim x0 As Long '居中显示
Dim y0 As Long
x0 = Screen.Width
y0 = Screen.Height
x0 = (x0 - Me.Width) / 2
y0 = (y0 - Me.Height) / 2
Me.Move x0, y0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -