📄 frmregister.frm
字号:
VERSION 5.00
Begin VB.Form frmregister
AutoRedraw = -1 'True
BackColor = &H80000013&
BorderStyle = 0 'None
Caption = "Regtistrar!!"
ClientHeight = 2805
ClientLeft = 0
ClientTop = 0
ClientWidth = 5430
Icon = "frmregister.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmregister.frx":000C
ScaleHeight = 2805
ScaleWidth = 5430
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin OnTheSpot.isButton cmdok
Height = 495
Left = 3960
TabIndex = 10
Top = 2160
Width = 1095
_extentx = 1931
_extenty = 873
icon = "frmregister.frx":6ECE
style = 9
caption = "&Ok"
inonthemestyle = 0
tooltiptitle = ""
tooltipicon = 0
tooltiptype = 1
ttforecolor = 0
font = "frmregister.frx":6EEA
maskcolor = 0
roundedbordersbytheme= 0 'False
End
Begin OnTheSpot.isButton cmdcancel
Height = 495
Left = 360
TabIndex = 9
Top = 2160
Width = 1215
_extentx = 2143
_extenty = 873
icon = "frmregister.frx":6F12
style = 9
caption = "Cancel"
inonthemestyle = 9
tooltiptitle = ""
tooltipicon = 0
tooltiptype = 1
ttforecolor = 0
font = "frmregister.frx":6F2E
maskcolor = 0
roundedbordersbytheme= 0 'False
End
Begin OnTheSpot.xVistaForm xVistaForm1
Align = 1 'Align Top
Height = 390
Left = 0
TabIndex = 8
Top = 0
Width = 5430
_extentx = 9578
_extenty = 688
style = 1
caption = "Registrar"
font = "frmregister.frx":6F56
fontbold = 0 'False
fontitalic = 0 'False
fontsize = 8.25
fontstrikethru = 0 'False
fontunderline = 0 'False
forecolor = 16777215
style = 1
End
Begin VB.ComboBox cboemp_no
Height = 315
Left = 1920
TabIndex = 6
Top = 600
Width = 3135
End
Begin VB.TextBox txtconfirmpassword
Appearance = 0 'Flat
Height = 285
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 5
Top = 1800
Width = 3135
End
Begin VB.TextBox txtpassword
Appearance = 0 'Flat
Height = 285
IMEMode = 3 'DISABLE
Left = 1920
MaxLength = 20
PasswordChar = "*"
TabIndex = 4
Top = 1440
Width = 3135
End
Begin VB.TextBox txtname
Appearance = 0 'Flat
Height = 285
Left = 1920
MaxLength = 20
TabIndex = 3
Top = 1080
Width = 3135
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "Employee Number"
Height = 255
Left = 360
TabIndex = 7
Top = 600
Width = 1455
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Confirm password"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 360
TabIndex = 2
Top = 1800
Width = 1575
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Password"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 360
TabIndex = 1
Top = 1440
Width = 1335
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Name"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 360
TabIndex = 0
Top = 1080
Width = 1335
End
End
Attribute VB_Name = "frmregister"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim validated As Boolean
Dim vaccumated As Boolean
Dim cn As ADODB.Connection
Dim RS As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Private Sub cboemp_no_Click()
Label2.ForeColor = vbBlack
End Sub
Private Sub cmdcancel_Click()
txtconfirmpassword.Text = ""
txtname.Text = ""
txtpassword.Text = ""
Unload Me
End Sub
Private Sub cmdok_Click()
vaccumate
If vaccumated = False Then
Exit Sub
End If
named = CStr(txtname.Text)
Password = CStr(txtpassword.Text)
confirm = CStr(txtconfirmpassword.Text)
If Password <> confirm Then
MsgBox "passwords do not match"
Exit Sub
Else
Register
End If
End Sub
Private Sub Register()
'Register a new username and password
On Error Resume Next
'Open recordsource
'Ready recordsource for adding username and password
'rs2.Open "Select * from Admin where Emp_ID='" & cboemp_no.Text & "'", cn
Set rs1 = New ADODB.Recordset
rs1.Open "select * from Admin", cn, adOpenDynamic, adLockPessimistic
rs1.AddNew
'Assign test boxes on form to their appropriate field in the recordsource
rs1("Emp_ID") = cboemp_no.Text
rs1("uname") = txtname.Text
rs1("upass") = txtpassword.Text
'Save record
rs1.Update
MsgBox "User Name and Password Created.", vbInformation, "Confirmation"
Unload Me
End Sub
Public Sub popul8_cbo()
Set rs1 = New ADODB.Recordset
rs1.Open "select * from employee", cn, adOpenDynamic, adLockPessimistic
Do
cboemp_no.AddItem rs1("employee_number")
rs1.MoveNext
Loop Until rs1.EOF = True
rs1.Close
Set rs1 = Nothing
End Sub
Private Sub Form_Load()
On Error Resume Next
Set cn = New ADODB.Connection
Set RS = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
popul8_cbo
End Sub
Public Sub vaccumate()
If cboemp_no.Text = "" Then
MsgBox "Employee Number Is required", vbInformation, "Verify employment status."
vaccumated = False
Label2.ForeColor = vbRed
Exit Sub
Else
vaccumated = True
End If
If txtname.Text = "" Then
MsgBox "A username is required!", vbInformation, "Nameless??"
vaccumated = False
Label1(0).ForeColor = vbRed
Exit Sub
End If
If txtpassword.Text = "" Then
MsgBox "A password is required!", vbInformation, "Password Verifier"
vaccumated = False
Label1(1).ForeColor = vbRed
Exit Sub
End If
End Sub
Private Sub txtconfirmpassword_Change()
Label1(2).ForeColor = vbBlack
End Sub
Private Sub txtname_Change()
Label1(0).ForeColor = vbBlack
End Sub
Private Sub txtpassword_Change()
Label1(1).ForeColor = vbBlack
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -