📄 注册.frm
字号:
VERSION 5.00
Begin VB.Form 注册
Caption = "用户注册"
ClientHeight = 6045
ClientLeft = 4350
ClientTop = 2145
ClientWidth = 7560
LinkTopic = "Form1"
ScaleHeight = 6045
ScaleWidth = 7560
Begin VB.CommandButton Command2
Caption = "返回"
BeginProperty Font
Name = "华文新魏"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4320
TabIndex = 10
Top = 5040
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确认"
BeginProperty Font
Name = "华文新魏"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 9
Top = 5040
Width = 1335
End
Begin VB.Frame Frame1
Caption = "注册信息"
Height = 3495
Left = 960
TabIndex = 0
Top = 960
Width = 5655
Begin VB.TextBox nametext
Height = 270
Left = 1560
TabIndex = 6
Top = 1080
Width = 1935
End
Begin VB.TextBox surepass
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 8
Top = 2760
Width = 1935
End
Begin VB.TextBox passtext
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 7
Top = 1920
Width = 1935
End
Begin VB.TextBox registext
Height = 270
Left = 1560
TabIndex = 5
Top = 360
Width = 1935
End
Begin VB.Label Label7
Caption = "密码长度在6-10位之间"
ForeColor = &H000000FF&
Height = 255
Left = 3720
TabIndex = 13
Top = 2040
Width = 1815
End
Begin VB.Label Label6
Caption = "用户名长度不超过10位"
ForeColor = &H000000FF&
Height = 255
Left = 3720
TabIndex = 12
Top = 360
Width = 1935
End
Begin VB.Label Label5
Caption = "姓 名"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 11
Top = 1080
Width = 975
End
Begin VB.Label Label4
Caption = "密码确认"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 4
Top = 2760
Width = 1095
End
Begin VB.Label Label3
Caption = "输入密码"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 3
Top = 1920
Width = 1095
End
Begin VB.Label Label2
Caption = "用户名"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 2
Top = 360
Width = 975
End
End
Begin VB.Label Label1
Caption = "欢 迎 使 用 超 市 管 理 系 统"
BeginProperty Font
Name = "华文彩云"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 1560
TabIndex = 1
Top = 240
Width = 5055
End
Begin VB.Image Image1
Height = 6045
Left = -1800
Picture = "注册.frx":0000
Top = 0
Width = 9360
End
End
Attribute VB_Name = "注册"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim i As Integer
Dim sql As String
Dim rs As New ADODB.Recordset
If NotEmpty(注册, "zhuce") = True Then '检测用户名、密码等是否为空
If checklenth(注册, "zhuce") = True Then '检查各项长度是否符合要求
If same(registext.Text) = 0 Then '如果用户名没有重复
If surepass.Text <> passtext.Text Then '密码不一致
MsgBox "密码不一致"
Else:
sql = "select * from yhxxb "
Set rs = exesql(sql)
rs.AddNew '将新用户的信息写入数据库
rs.Fields("yhm") = Trim(registext.Text)
rs.Fields("mm") = Trim(passtext.Text)
rs.Fields("xm") = Trim(nametext.Text)
rs.Fields("yhsf") = "待定用户"
rs.Update
rs.Close
Set rs = Nothing
yhm = Trim(registext.Text) '用全局变量yhm,yhsf,mm来记录用户名和用户权限,密码
yhsf = "待定用户"
mm = Trim(passtext.Text)
MsgBox "注册成功!"
主界面.Show
Unload Me
End If
Else:
MsgBox "用户名重复!请重新输入!"
registext.SetFocus
registext.Text = ""
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload 注册
denglujiemian.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -