📄 user_frm.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form user_frm
Caption = "用户注册窗体"
ClientHeight = 3555
ClientLeft = 60
ClientTop = 345
ClientWidth = 5190
LinkTopic = "Form1"
ScaleHeight = 3555
ScaleWidth = 5190
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "用户注册"
ForeColor = &H00000000&
Height = 1935
Left = 600
TabIndex = 2
Top = 240
Width = 4095
Begin VB.TextBox Text1
Height = 270
Left = 1080
TabIndex = 6
Top = 480
Width = 1455
End
Begin VB.TextBox Text2
Height = 270
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 5
Top = 960
Width = 1455
End
Begin VB.TextBox Text3
Height = 270
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 4
Top = 1440
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "检测用户名"
Height = 420
Left = 2640
TabIndex = 3
Top = 360
Width = 1095
End
Begin VB.Label Label3
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "用户名:"
ForeColor = &H00000000&
Height = 180
Left = 360
TabIndex = 9
Top = 480
Width = 720
End
Begin VB.Label Label4
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "密码:"
ForeColor = &H00000000&
Height = 180
Left = 480
TabIndex = 8
Top = 960
Width = 555
End
Begin VB.Label Label5
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "确认密码:"
ForeColor = &H00000000&
Height = 180
Left = 120
TabIndex = 7
Top = 1440
Width = 900
End
End
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 375
Left = 2880
TabIndex = 1
Top = 2520
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "注册用户"
Height = 375
Left = 840
TabIndex = 0
Top = 2520
Width = 1335
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "user_frm.frx":0000
Height = 735
Left = 3000
TabIndex = 10
Top = 3960
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 1296
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 735
Left = 960
Top = 3960
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 1296
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VB实习\db1.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VB实习\db1.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "pwd"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "user_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim qx_jubu As String
If qx = "学生" Then
qx_jubu = "学生"
ElseIf qx = "老师" Then
qx_jubu = "老师"
ElseIf qx = "管理员" Then
qx_jubu = "管理员"
End If
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "请输入完整的信息", vbOKOnly + vbInformation, "用户注册"
Text1.SetFocus
Else
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from pwd where 用户名='" & Text1.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = True Then
If Trim(Text2.Text) = Trim(Text3.Text) Then
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("用户名") = Trim(Text1.Text)
Adodc1.Recordset.Fields("密码") = Trim(Text2.Text)
Adodc1.Recordset.Fields("权限") = qx_jubu
Adodc1.Recordset.Update
MsgBox "注册成功", vbOKOnly + vbInformation, "用户注册"
Unload Me
Else
MsgBox "第二次和第一次密码不同,请重新输入!", vbOKOnly + vbCritical, "用户注册"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
End If
Else
MsgBox "用户名已经存在,请用另一个用户名!", vbOKOnly + vbCritical, "用户注册"
Text1.Text = ""
Text1.SetFocus
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from pwd where 用户名='" & Trim(Text1.Text) & "'"
Adodc1.Refresh
If Text1.Text = "" Then
MsgBox "请输入你将要添加的用户帐号!", vbCritical + vbOKOnly, "添加用户提示"
Text1.SetFocus
ElseIf Adodc1.Recordset.EOF = False Then
MsgBox "该用户已存在,请重新输入!", vbCritical + vbOKOnly, "添加用户提示"
Text1.Text = ""
Text1.SetFocus
Else
MsgBox "恭喜您!您可以使用该名字!", vbInformation + vbOKOnly, "添加用户提示"
Text2.SetFocus
End If
End Sub
Private Sub Form_Activate()
Text1.SetFocus
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -