📄 useroption.frm
字号:
VERSION 5.00
Begin VB.Form Useroption
BackColor = &H00C0E0FF&
BorderStyle = 1 'Fixed Single
Caption = "Users Option"
ClientHeight = 4650
ClientLeft = 45
ClientTop = 330
ClientWidth = 5310
Icon = "Useroption.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4650
ScaleWidth = 5310
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\visual basic\Library\Data\VISDATA\initialsc.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 3960
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "Usersinfo"
Top = 1080
Visible = 0 'False
Width = 1215
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "Cancel"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3000
TabIndex = 6
Top = 3960
Width = 1815
End
Begin VB.CommandButton cmdOk
Caption = "Create"
Default = -1 'True
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 5
Top = 3960
Width = 1815
End
Begin VB.TextBox txtUsercpsswd
Height = 375
IMEMode = 3 'DISABLE
Left = 2040
PasswordChar = "*"
TabIndex = 4
Top = 3360
Width = 1695
End
Begin VB.TextBox txtUserpsswd
Height = 375
IMEMode = 3 'DISABLE
Left = 2040
PasswordChar = "*"
TabIndex = 3
Top = 2760
Width = 1695
End
Begin VB.TextBox txtUserid
Height = 375
Left = 2040
TabIndex = 2
Top = 2040
Width = 1695
End
Begin VB.TextBox txtusername
Height = 375
Left = 2040
TabIndex = 1
Top = 1320
Width = 1695
End
Begin VB.CommandButton CmdChange
Caption = "Delete"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3000
TabIndex = 7
Top = 480
Width = 1815
End
Begin VB.CommandButton CmdAdd
Caption = "Add User"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 0
Top = 480
Width = 1815
End
Begin VB.Label Label4
BackColor = &H00C0E0FF&
Caption = "Confirm Password:"
BeginProperty Font
Name = "Times New Roman"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 11
Top = 3360
Width = 1695
End
Begin VB.Label Label3
BackColor = &H00C0E0FF&
Caption = "Password:"
BeginProperty Font
Name = "Times New Roman"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 10
Top = 2760
Width = 1215
End
Begin VB.Label Label2
BackColor = &H00C0E0FF&
Caption = "User Id:"
BeginProperty Font
Name = "Times New Roman"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 9
Top = 2100
Width = 1215
End
Begin VB.Label Label1
BackColor = &H00C0E0FF&
Caption = "User Name:"
BeginProperty Font
Name = "Times New Roman"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 8
Top = 1320
Width = 1215
End
End
Attribute VB_Name = "Useroption"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'This library project is created by Vipin Panicker. E-Mail: itsvipin@hotmail.com
Private Sub CmdAdd_Click()
cmdOk.Caption = "Create"
Data1.Recordset.AddNew
txtusername.Enabled = True
txtUserpsswd.Enabled = True
txtUserid.Enabled = True
txtUsercpsswd.Enabled = True
txtusername.SetFocus
End Sub
Private Sub CmdChange_Click()
cmdOk.Caption = "Delete"
txtusername.Enabled = False
txtUserpsswd.Enabled = False
txtUsercpsswd.Enabled = False
txtUserid.Enabled = True
txtUserid.SetFocus
End Sub
Private Sub cmdOK_Click()
On Error GoTo vip
If cmdOk.Caption = "Create" Then
If txtUserpsswd.Text = txtUsercpsswd.Text Then
Data1.Recordset.Fields("tusername") = txtusername.Text
Data1.Recordset.Fields("tuserid") = txtUserid.Text
Data1.Recordset.Fields("tpassword") = txtUserpsswd.Text
Data1.Recordset.Update
MsgBox "User Created."
txtusername.Text = ""
txtUserpsswd.Text = ""
txtUserid.Text = ""
txtUsercpsswd.Text = ""
txtusername.Enabled = False
txtUserpsswd.Enabled = False
txtUserid.Enabled = False
Else
MsgBox "confirm password."
End If
vip:
If Err.Number = 3022 Then
MsgBox "User already exists with the name " & txtusername.Text, vbOKOnly
txtUserid.SetFocus
End If
Else
Data1.Recordset.FindFirst ("tuserid='" & txtUserid.Text & "'")
If Data1.Recordset.NoMatch = True Then
MsgBox "no user found."
Else
Data1.Recordset.Delete
MsgBox "User deleted."
End If
End If
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
cmdOk.Caption = "Change"
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\initialsc.mdb"
txtusername.Text = ""
txtUserpsswd.Text = ""
txtUserid.Text = ""
txtusername.Enabled = False
txtUserpsswd.Enabled = False
txtUserid.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -