📄 form4.frm
字号:
VERSION 5.00
Begin VB.Form Form4
Caption = "用户增删"
ClientHeight = 2640
ClientLeft = 60
ClientTop = 345
ClientWidth = 5880
LinkTopic = "Form4"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2640
ScaleWidth = 5880
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "增加"
Height = 375
Left = 2640
TabIndex = 6
Top = 960
Width = 735
End
Begin VB.TextBox Txtpasd
Height = 270
IMEMode = 3 'DISABLE
Left = 4200
PasswordChar = "*"
TabIndex = 3
Top = 1275
Width = 1455
End
Begin VB.TextBox txtname
Height = 270
Left = 4200
TabIndex = 2
Top = 795
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Left = 1320
TabIndex = 1
Top = 960
Width = 735
End
Begin VB.ListBox listuser
Height = 960
Left = 360
TabIndex = 0
Top = 600
Width = 855
End
Begin VB.Label Label2
Caption = "口令"
Height = 255
Left = 3480
TabIndex = 5
Top = 1275
Width = 615
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 3480
TabIndex = 4
Top = 795
Width = 615
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Dim i As Integer
Private Sub Command1_Click()
If listuser.Text = "" Then
Exit Sub
End If
rs1.MoveFirst
rs1.Find "user='" + listuser.Text + "'"
rs1.Delete
rs1.Update
rs1.Requery
rs1.MoveFirst
listuser.Clear
Do While Not rs1.EOF
If rs1!User <> "admin" Then
listuser.AddItem rs1!User
End If
rs1.MoveNext
Loop
End Sub
Private Sub Command2_Click()
If Len(txtname.Text) = 0 Or Len(txtname.Text) > 8 Then
MsgBox "用户名不能为空或多于八个字符"
Exit Sub
End If
If Len(Txtpasd.Text) = 0 Or Len(Txtpasd.Text) > 6 Then
MsgBox "口令不能为空或大于6个字符"
Exit Sub
End If
Call bas.savepasswd(txtname.Text, Txtpasd.Text, 1)
rs1.Requery
rs1.MoveFirst
listuser.Clear
Do While Not rs1.EOF
If rs1!User <> "admin" Then
listuser.AddItem rs1!User
End If
rs1.MoveNext
Loop
txtname.Text = ""
Txtpasd.Text = ""
'listuser.AddItem txtname.Text
End Sub
Private Sub Form_Load()
'Form1.Enabled = False
listuser.Clear
Call bas.openrs(rs1, "select user from passd")
rs1.MoveFirst
Do While Not rs1.EOF
If rs1!User <> "admin" Then
listuser.AddItem rs1!User
End If
rs1.MoveNext
Loop
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs1.Close
Set rs1 = Nothing
'Form1.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -