📄 删除用户.frm
字号:
VERSION 5.00
Begin VB.Form Frm_DelUser
BorderStyle = 1 'Fixed Single
Caption = "删除用户"
ClientHeight = 3900
ClientLeft = 45
ClientTop = 330
ClientWidth = 4515
Icon = "删除用户.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3900
ScaleWidth = 4515
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3120
TabIndex = 3
Top = 3120
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "删除"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3120
TabIndex = 2
Top = 2160
Width = 1215
End
Begin VB.ListBox List1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3420
ItemData = "删除用户.frx":1042
Left = 1200
List = "删除用户.frx":1044
TabIndex = 0
Top = 360
Width = 1455
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = $"删除用户.frx":1046
ForeColor = &H00FF0000&
Height = 900
Left = 3000
TabIndex = 4
Top = 600
Width = 1440
End
Begin VB.Label Label1
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 1
Top = 240
Width = 855
End
End
Attribute VB_Name = "Frm_DelUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim r As New ADODB.Recordset
Private Sub Command1_Click()
If List1.Text = "" Then
MsgBox "请选择要删除的用户名!", vbOKOnly, "警告"
Exit Sub
End If
r.Open "select * from 管理人员 where username='" & Trim(List1.Text) & "'", conn, 3, 3
If r.Fields("username") = ym Then
MsgBox "不能删除当前用户!"
r.Close
Exit Sub
End If
If (MsgBox("真的要删除记录吗?", vbQuestion + vbYesNo, "删除提示") = vbYes) Then
r.Delete
List1.RemoveItem (List1.ListIndex)
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
main.StatusBar1.Panels(10) = Me.Caption
Call opendatabase
Dim a As String
r.Open "select * from 管理人员", conn, 3, 3
Do While Not r.EOF
a = r.Fields(0)
List1.AddItem a
r.MoveNext
Loop
r.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
conn.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -