📄 frmadminarea.frm
字号:
VERSION 5.00
Begin VB.Form frmAdminArea
BorderStyle = 3 'Fixed Dialog
ClientHeight = 4680
ClientLeft = 45
ClientTop = 150
ClientWidth = 7200
ControlBox = 0 'False
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmAdminArea.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4680
ScaleWidth = 7200
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame5
Height = 855
Left = 480
TabIndex = 16
Top = 3360
Width = 6255
Begin VB.CommandButton Command5
Caption = "Exit"
Height = 495
Left = 4440
Style = 1 'Graphical
TabIndex = 18
Top = 240
Width = 1695
End
Begin VB.CommandButton Command6
Caption = "Main"
Height = 495
Left = 120
Style = 1 'Graphical
TabIndex = 17
Top = 240
Width = 1695
End
End
Begin VB.Frame Frame4
Height = 735
Left = 3600
TabIndex = 13
Top = 840
Width = 3135
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "time"
Height = 375
Left = 1560
TabIndex = 14
Top = 240
Width = 1455
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "date"
Height = 375
Left = 120
TabIndex = 15
Top = 240
Width = 1455
End
End
Begin VB.Frame Frame2
Height = 735
Left = 3600
TabIndex = 12
Top = 2160
Width = 3135
Begin VB.CommandButton cmdEdit
Caption = "Update"
Height = 375
Left = 1560
Style = 1 'Graphical
TabIndex = 3
Top = 240
Width = 735
End
Begin VB.CommandButton cmdAdd
Caption = "Add"
Height = 375
Left = 120
Style = 1 'Graphical
TabIndex = 0
Top = 240
Width = 735
End
Begin VB.CommandButton cmdDelete
Caption = "Delete"
Height = 375
Left = 2280
Style = 1 'Graphical
TabIndex = 4
Top = 240
Width = 735
End
Begin VB.CommandButton cmdSave
Caption = "Save"
Height = 375
Left = 840
Style = 1 'Graphical
TabIndex = 2
Top = 240
Width = 735
End
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 375
Left = 120
Style = 1 'Graphical
TabIndex = 1
Top = 240
Width = 735
End
End
Begin VB.Timer Timer1
Interval = 100
Left = 0
Top = 1680
End
Begin VB.Frame Frame1
Caption = "Users"
Height = 735
Left = 480
TabIndex = 9
Top = 840
Width = 3015
Begin VB.ComboBox Combo1
Height = 330
Left = 120
TabIndex = 10
Top = 240
Width = 2775
End
End
Begin VB.Frame Frame8
Caption = "User Name"
Height = 735
Left = 480
TabIndex = 5
Top = 1680
Width = 3015
Begin VB.TextBox txtUserName
Alignment = 2 'Center
BackColor = &H00FFFFFF&
Height = 375
Left = 120
TabIndex = 6
Top = 240
Width = 2775
End
End
Begin VB.Frame Frame6
Caption = "Password"
Height = 735
Left = 480
TabIndex = 7
Top = 2520
Width = 3015
Begin VB.TextBox txtPassword
Alignment = 2 'Center
BackColor = &H00FFFFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 120
PasswordChar = "*"
TabIndex = 8
Top = 240
Width = 2775
End
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "Administrator Area"
BeginProperty Font
Name = "Monotype Corsiva"
Size = 18
Charset = 0
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 960
TabIndex = 19
Top = 360
Width = 5055
End
Begin VB.Label Label3
BorderStyle = 1 'Fixed Single
Height = 375
Left = 2760
TabIndex = 11
Top = 3600
Width = 855
End
Begin VB.Shape Shape1
BackColor = &H8000000F&
BackStyle = 1 'Opaque
BorderColor = &H00FF8080&
BorderWidth = 10
Height = 4215
Left = 240
Top = 240
Width = 6735
End
End
Attribute VB_Name = "frmAdminArea"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim nad As String
Dim e As Integer
Private Sub cmdAdd_Click()
nad = "add"
cmdSave.Enabled = True
cmdDelete.Enabled = False
cmdEdit.Enabled = False
cmdAdd.Visible = False
txtUserName = ""
txtPassword = ""
txtUserName.SetFocus
Combo1 = ""
Label3 = ""
Combo1.Enabled = False
End Sub
Private Sub cmdCancel_Click()
cmdAdd.Visible = True
cmdSave.Enabled = False
nad = "dli"
txtUserName = ""
txtPassword = ""
Combo1 = ""
Label3 = ""
cmdDelete.Enabled = False
Combo1.Enabled = True
End Sub
Private Sub cmdDelete_Click()
If MsgBox("Do you really want to delete the record of " & txtUserName, vbYesNo) = vbYes Then
Cnn.Execute "delete from user_login where user_id = " & Label3
rs.Requery 1
cmdDelete.Enabled = False
cmdEdit.Enabled = False
txtUserName = ""
txtPassword = ""
Label3 = ""
Combo1.Clear
check_RS1
rs1.Open "select * from user_login order by user_id asc", Cnn
While Not rs1.EOF
Combo1.AddItem (rs1(1))
rs1.MoveNext
Wend
End If
End Sub
Private Sub cmdEdit_Click()
If nad = "edit" Then
check_RS1
rs1.Open "select * from user_login order by user_id asc", Cnn
Cnn.Execute "update user_login set user_name = '" & txtUserName & "', user_password = '" & txtPassword & "' where user_id = " & Label3
rs1.Requery
Combo1.Clear
check_RS1
rs1.Open "select * from user_login order by user_id asc", Cnn
While Not rs1.EOF
Combo1.AddItem (rs1(1))
rs1.MoveNext
Wend
MsgBox "User Updated!", vbInformation, "IIS-CVH"
txtPassword = ""
txtUserName = ""
cmdEdit.Enabled = False
cmdDelete.Enabled = False
End If
End Sub
Private Sub cmdSave_Click()
e = 1
If txtUserName.Text = "" Then
MsgBox "Please enter your User Name...", vbInformation, "IIS-CVH"
txtUserName.SetFocus
Exit Sub
ElseIf txtPassword.Text = "" Then
MsgBox "Please enter your Password...", vbInformation, "IIS-CVH"
txtPassword.SetFocus
Exit Sub
Else
If nad = "add" Then
check_RStemp
rstemp.Open "select * from user_login", Cnn
'================
While rstemp.RecordCount > 0
check_RStemp
e = e + 1
rstemp.Open "select * from user_login where user_id = " & e, Cnn
Wend
'================
Cnn.Execute "INSERT INTO user_login (user_id, user_name, user_password) VALUES ('" & e & _
"', '" & txtUserName & "', '" & txtPassword & "')" '
End If
rs.Requery 1
MsgBox "New user added", vbInformation, "IIS=CVH"
cmdSave.Enabled = False
cmdAdd.Visible = True
txtUserName = ""
txtPassword = ""
Combo1.Enabled = True
cmdAdd.SetFocus
End If
Combo1.Clear
check_RS1
rs1.Open "select * from user_login order by user_id asc", Cnn
While Not rs1.EOF
Combo1.AddItem (rs1(1))
rs1.MoveNext
Wend
End Sub
Private Sub Combo1_Click()
check_RS
rs.Open "select * from user_login order by user_id asc", Cnn
While Not rs.EOF
If Combo1.Text = rs!user_name Then
txtUserName.Text = rs!user_name
txtPassword.Text = rs!user_password
Label3 = rs!user_id
rs.MoveLast
rs.MoveNext
Else
rs.MoveNext
End If
Wend
cmdDelete.Enabled = True
cmdEdit.Enabled = True
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub Command6_Click()
'Load frmMain
'frmMain.Show 1
'frmAdmin.Hide
'frmMain.Show vbModal
'Unload Me
If frmMain.nad = "open" Then
'Load frmAdminArea
'frmAdminArea.Show '1
frmMain.nad = "open"
Unload Me
ElseIf frmLogin.ron = "close" Then
Load frmMain
frmMain.Show 1
frmLogin.Hide
frmMain.nad = "open"
End If
End Sub
Private Sub Form_Load()
Label1 = Date
Combo1.Clear
check_RS1
rs1.Open "select * from user_login order by user_id asc", Cnn
While Not rs1.EOF
Combo1.AddItem (rs1(1))
rs1.MoveNext
Wend
cmdSave.Enabled = False
cmdDelete.Enabled = False
cmdEdit.Enabled = False
nad = "edit"
End Sub
Private Sub Timer1_Timer()
Label2 = Time
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -