📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form login2
Caption = "注册用户"
ClientHeight = 3675
ClientLeft = 60
ClientTop = 345
ClientWidth = 6735
LinkTopic = "Form3"
ScaleHeight = 3675
ScaleWidth = 6735
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3360
TabIndex = 7
Top = 2760
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 1680
TabIndex = 6
Top = 2760
Width = 1215
End
Begin VB.TextBox Text3
Height = 495
Left = 1800
TabIndex = 2
Top = 1920
Width = 2775
End
Begin VB.TextBox Text2
Height = 495
Left = 1800
TabIndex = 1
Top = 1320
Width = 2775
End
Begin VB.TextBox Text1
Height = 495
Left = 1800
TabIndex = 0
Top = 720
Width = 2775
End
Begin VB.Label Label4
Caption = "请 输 入 用 户 名 密 码"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 255
Left = 1440
TabIndex = 8
Top = 240
Width = 3375
End
Begin VB.Label Label3
Caption = "再次输入密码"
ForeColor = &H00FF00FF&
Height = 375
Left = 480
TabIndex = 5
Top = 2040
Width = 1215
End
Begin VB.Label Label2
Caption = "密 码"
ForeColor = &H00FF00FF&
Height = 255
Left = 480
TabIndex = 4
Top = 1440
Width = 975
End
Begin VB.Label Label1
Caption = "用 户 名"
ForeColor = &H00FF00FF&
Height = 255
Left = 480
TabIndex = 3
Top = 840
Width = 1095
End
End
Attribute VB_Name = "login2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim rs As ADODB.Recordset
If Trim(Text2.Text) <> Trim(Text3.Text) Then
MsgBox "两次密码输入不同", vbOKOnly + vbExclamation, "警告!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Else
If (Text1.Text = "") And (Text2.Text = "") Then
MsgBox " 用户名密码不能为空 ", vbOKOnly + vbExclamation, "提示!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Else
sql = "select * from username where userid='" & Text1.Text & "'"
Set rs = TransactSQL(sql)
If rs.EOF = flase Then
MsgBox "用户名已存在", vbOKOnly + vbExclamation, "提示!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
Else
rs.addnew
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text2.Text
rs.update
MsgBox "添加用户成功", vbOKOnly + vbExclamation, "提示!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
Exit Sub
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_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -