📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form Form3
Caption = "用户管理"
ClientHeight = 5310
ClientLeft = 4035
ClientTop = 3555
ClientWidth = 7575
LinkTopic = "Form3"
MDIChild = -1 'True
Picture = "Form3.frx":0000
ScaleHeight = 5310
ScaleWidth = 7575
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form3.frx":A9F0E
Left = 2520
List = "Form3.frx":A9F18
TabIndex = 11
Top = 1440
Width = 3015
End
Begin VB.ListBox List1
Height = 1500
IntegralHeight = 0 'False
Left = 5640
TabIndex = 6
Top = 1080
Width = 1815
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 5040
TabIndex = 9
Top = 4200
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 3240
TabIndex = 8
Top = 4200
Width = 1215
End
Begin VB.TextBox Text3
Height = 495
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 2
Top = 2880
Width = 3135
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 1
Top = 2160
Width = 3135
End
Begin VB.TextBox Text1
Height = 495
Left = 2520
TabIndex = 0
Top = 600
Width = 3615
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "设置权限:"
BeginProperty Font
Name = "华文中宋"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1200
TabIndex = 10
Top = 1440
Width = 1425
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "重新输入密码:"
BeginProperty Font
Name = "华文中宋"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 600
TabIndex = 7
Top = 3000
Width = 1995
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码:"
BeginProperty Font
Name = "华文中宋"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1740
TabIndex = 5
Top = 2280
Width = 855
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名:"
BeginProperty Font
Name = "华文中宋"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1455
TabIndex = 4
Top = 720
Width = 1140
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "楷体_GB2312"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 3480
TabIndex = 3
Top = 360
Width = 240
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim str As String
Set rs = New Recordset
If Form3.Caption = "添加用户" Then
If Text1.Text = "" Then
MsgBox "请您输入用户名!", vbCritical, "提示"
Text1.SetFocus
Else
If Text2.Text = Text3.Text Then
str = "select * from dl where mc= '" & Trim(Text1.Text) & " '"
lian str, cn, rs
If rs.RecordCount > 0 Then
MsgBox "您输入的用户名已存在请重新输入!", vbCritical, "失败"
Text1.Text = ""
Text1.SetFocus
Else
str = "select * from dl"
Call lian(str, cn, rs)
rs.AddNew
rs!mc = Text1.Text
rs!mm = Text2.Text
rs!qx = Combo1.Text
rs.Update
MsgBox "添加成功!", vbInformation, "成功"
End If
Call qk
Else
MsgBox "您输入的密码不同,请重新输入!", vbCritical, "提示"
Text3.Text = ""
Text3.SetFocus
End If
End If
ElseIf Form3.Caption = "查找用户" Then
str = "select * from dl where mc= '" & Trim(Text1.Text) & " '"
lian str, cn, rs
If rs.RecordCount = 1 Then
MsgBox "查找成功", vbCritical, "成功"
Else
MsgBox "查无此用户名", vbCritical, "查不到"
End If
Else
If Text1.Text = "" Then
MsgBox "请您输入用户名!", vbCritical, "提示"
Else
str = "select * from dl where mc='" & Trim(Text1.Text) & "'"
Call lian(str, cn, rs)
rs.Delete
rs.Update
MsgBox "删除成功!", vbInformation, "成功"
Call qk
End If
End If
End Sub
Private Sub Command2_Click()
Call sh
End Sub
Private Sub Form_Load()
List1.Visible = False
End Sub
Private Sub List1_Click()
Text1.Text = List1.Text
List1.Visible = False
End Sub
Private Sub Text1_Change()
List1.Clear
If Text1.Text = "" Then
List1.Visible = False
Else
List1.Visible = True
Dim str As String
Set rs = New Recordset
str = "select * from dl where mc like '%" & Trim(Text1.Text) & "%'"
Call lian(str, cn, rs)
If rs.RecordCount < 1 Then
List1.Visible = False
Else
Dim i As Integer
For i = 1 To rs.RecordCount
If Trim(rs!mc) = Trim(Text1.Text) Then List1.Visible = False
List1.AddItem (rs!mc)
rs.MoveNext
Next i
cn.Close
End If
End If
If Text1.Text = List1.Text Then List1.Visible = False
End Sub
Private Sub qk()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -