?? frmpass.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmuser
BackColor = &H00FFFF00&
Caption = "管理員設置"
ClientHeight = 4410
ClientLeft = 240
ClientTop = 1530
ClientWidth = 5565
Icon = "frmpass.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4410
ScaleWidth = 5565
Begin VB.ComboBox comgrd
Height = 300
ItemData = "frmpass.frx":144A
Left = 2640
List = "frmpass.frx":144C
TabIndex = 4
Top = 3000
Width = 2175
End
Begin VB.PictureBox Picture1
BackColor = &H0080FFFF&
Height = 1215
Left = 0
ScaleHeight = 1155
ScaleWidth = 4875
TabIndex = 10
Top = 0
Width = 4935
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "=>權限1最大3最小"
ForeColor = &H00000000&
Height = 180
Index = 4
Left = 2400
TabIndex = 19
Top = 840
Width = 1440
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "添加設置管理員:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 210
Index = 0
Left = 360
TabIndex = 14
Top = 360
Width = 1680
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "=>輸入各項之后按保存"
ForeColor = &H00000000&
Height = 180
Index = 1
Left = 2400
TabIndex = 13
Top = 600
Width = 1800
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "=>雙擊列表可修改設置"
ForeColor = &H00000000&
Height = 180
Index = 2
Left = 2400
TabIndex = 12
Top = 120
Width = 1800
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "=>單擊右鍵顯示菜單"
ForeColor = &H00000000&
Height = 180
Index = 3
Left = 2400
TabIndex = 11
Top = 360
Width = 1620
End
End
Begin VB.Frame Frame1
BackColor = &H00FFFF00&
Caption = "管理員列表"
Height = 2535
Left = 0
TabIndex = 8
Top = 1200
Width = 1695
Begin MSComctlLib.ListView Lv
Height = 2055
Left = 120
TabIndex = 9
Top = 360
Width = 1455
_ExtentX = 2566
_ExtentY = 3625
View = 3
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 1
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "管理員"
Object.Width = 2540
EndProperty
End
End
Begin VB.Frame Frame2
BackColor = &H00FFFF00&
Height = 135
Left = 0
TabIndex = 7
Top = 720
Width = 4935
End
Begin VB.TextBox txtName
Height = 270
Left = 2640
TabIndex = 1
Top = 1560
Width = 2175
End
Begin VB.TextBox txtPass
Height = 270
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 2
Top = 2040
Width = 2175
End
Begin VB.TextBox txtOkPass
Height = 270
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 3
Top = 2520
Width = 2175
End
Begin VB.Frame Frame3
Height = 135
Left = 1920
TabIndex = 6
Top = 3600
Width = 3135
End
Begin VB.CommandButton cmdSave
BackColor = &H000080FF&
Caption = "保存(&S)"
Enabled = 0 'False
Height = 375
Left = 2520
TabIndex = 5
Top = 3720
Width = 855
End
Begin VB.CommandButton cmdExit
Caption = "關閉(&C)"
Height = 375
Left = 3840
TabIndex = 0
Top = 3720
Width = 855
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "權限"
Height = 180
Left = 2040
TabIndex = 18
Top = 3000
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 180
Index = 0
Left = 2040
TabIndex = 17
Top = 1560
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "口令"
Height = 180
Index = 1
Left = 2040
TabIndex = 16
Top = 2040
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "重復"
Height = 180
Index = 2
Left = 2040
TabIndex = 15
Top = 2520
Width = 360
End
Begin VB.Menu MainMnu
Caption = "MainMnu"
Visible = 0 'False
Begin VB.Menu EditMnu
Caption = "修改"
End
Begin VB.Menu DeleteMnu
Caption = "刪除(&D)"
End
Begin VB.Menu s2
Caption = "-"
End
Begin VB.Menu ExitMnu
Caption = "退出"
End
End
End
Attribute VB_Name = "frmuser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As ADODB.Connection
Dim rstp As ADODB.Recordset
Dim Rec As Integer
Dim StrFlag As String
Dim sql As String
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
If StrFlag = "修改" Then
If txtName.Text = "" Or txtPass.Text = "" Or txtOkPass = "" Then
MsgBox "請將所有信息填寫完整!", 0 + 16, "提示"
Exit Sub
End If
If txtPass.Text <> txtOkPass.Text Then
MsgBox "密碼不相同!", 0 + 16, "密碼"
txtOkPass.SetFocus
Exit Sub
End If
rstp.MoveFirst
rstp.Move (Lv.SelectedItem.Index - 1)
rstp.Fields("user") = txtName.Text
rstp.Fields("password") = Trim(txtPass.Text)
rstp.Fields("grade") = comgrd
rstp.Update
Disp
StrFlag = ""
MsgBox "修改成功!", 0 + 48, "提示"
Else
If txtName.Text = "" Or txtPass.Text = "" Or txtOkPass = "" Then
MsgBox "請將所有信息填寫完整!", 0 + 16, "提示"
Exit Sub
End If
If txtPass.Text <> txtOkPass.Text Then
MsgBox "密碼不相同!", 0 + 16, "密碼"
txtOkPass.SetFocus
Exit Sub
End If
rstp.AddNew
rstp.Fields("user") = txtName.Text
rstp.Fields("password") = Trim(txtPass.Text)
rstp.Fields("grade") = comgrd
rstp.Update
Disp
StrFlag = ""
MsgBox "添加成功!", 0 + 48, "提示"
End If
txtName.Text = ""
txtPass.Text = ""
txtOkPass.Text = ""
comgrd.Text = ""
End Sub
Private Sub DeleteMnu_Click()
Dim str As String
If Lv.SelectedItem.Text = "superuser" Then
MsgBox "超級用戶不能刪除!", 0 + 16, "錯誤"
Exit Sub
End If
str = "確實要刪除 " & Lv.SelectedItem.Text & "嗎?"
If MsgBox(str, 4 + 32, "刪除") = vbYes Then
rstp.MoveFirst
rstp.Move (Lv.SelectedItem.Index - 1)
rstp.Delete
DoEvents
rstp.MoveNext
Disp
End If
End Sub
Private Sub EditMnu_Click()
Lv_DblClick
End Sub
Private Sub Form_Load()
Dim str As String
Set db = New ADODB.Connection
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\database\trade.mdb;Persist Security Info=False"
Set rstp = New ADODB.Recordset
str = "select * from pass"
rstp.Open str, db, adOpenKeyset, adLockOptimistic
Disp
comgrd.AddItem ("1")
comgrd.AddItem ("2")
comgrd.AddItem ("3")
End Sub
Private Sub Disp()
Lv.ListItems.Clear
rstp.MoveLast
Rec = rstp.RecordCount
rstp.MoveFirst
For i = 1 To Rec
Lv.ListItems.Add i, , rstp.Fields("user")
rstp.MoveNext
If rstp.EOF Then Exit Sub
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
rstp.Close
db.Close
End Sub
Private Sub Lv_DblClick()
If Lv.SelectedItem.Text = "superuser" Then
MsgBox "超級用戶不能修改!", 0 + 16, "錯誤"
Exit Sub
End If
StrFlag = "修改"
txtName.Text = Lv.SelectedItem.Text
End Sub
Private Sub Lv_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
PopupMenu MainMnu
End If
End Sub
Private Sub txtName_Change()
If txtName.Text <> "" Then
cmdSave.Enabled = True
Else
cmdSave.Enabled = False
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -