⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form_yhgl.frm

📁 射频卡收费系统 自主开发 可以用于任何商业收费场所
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form_yhgl 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "用户管理"
   ClientHeight    =   4695
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   8685
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   12
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "Form_yhgl.frx":0000
   LinkTopic       =   "Form4"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4695
   ScaleWidth      =   8685
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command6 
      Caption         =   "放 弃"
      Height          =   375
      Left            =   3480
      TabIndex        =   12
      Top             =   3840
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "退 出"
      Height          =   375
      Left            =   6840
      TabIndex        =   10
      Top             =   3840
      Width           =   1335
   End
   Begin VB.CommandButton Command4 
      Caption         =   "确 定"
      Height          =   375
      Left            =   5280
      TabIndex        =   9
      Top             =   3840
      Width           =   1095
   End
   Begin VB.Frame Frame1 
      Height          =   3255
      Left            =   3480
      TabIndex        =   2
      Top             =   240
      Width           =   4695
      Begin VB.CommandButton Command3 
         Caption         =   "删 除"
         Height          =   375
         Left            =   3240
         TabIndex        =   11
         Top             =   2520
         Width           =   1095
      End
      Begin VB.CommandButton Command2 
         Caption         =   "修 改"
         Height          =   375
         Left            =   1800
         TabIndex        =   8
         Top             =   2520
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "增 加"
         Height          =   375
         Left            =   360
         TabIndex        =   7
         Top             =   2520
         Width           =   1095
      End
      Begin VB.TextBox Text2 
         Height          =   375
         IMEMode         =   3  'DISABLE
         Left            =   1800
         Locked          =   -1  'True
         PasswordChar    =   "*"
         TabIndex        =   6
         Top             =   1560
         Width           =   1575
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   1800
         Locked          =   -1  'True
         TabIndex        =   4
         Top             =   720
         Width           =   1575
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "密  码"
         Height          =   240
         Left            =   480
         TabIndex        =   5
         Top             =   1680
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "用户名"
         Height          =   240
         Left            =   480
         TabIndex        =   3
         Top             =   840
         Width           =   720
      End
   End
   Begin VB.ComboBox Combo1 
      Height          =   360
      Left            =   600
      TabIndex        =   1
      Text            =   "Combo1"
      Top             =   300
      Width           =   2535
   End
   Begin VB.ListBox List1 
      Height          =   3420
      Left            =   600
      TabIndex        =   0
      Top             =   780
      Width           =   2535
   End
End
Attribute VB_Name = "Form_yhgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lianjie As New Connection
Dim yh As Recordset


Private Sub Combo1_Click()
    Set yh = New Recordset
    yh.CursorLocation = adUseClient
    yh.CursorType = adOpenDynamic
    yh.LockType = adLockOptimistic
   
    yh.Open "select * from 权限 where 权限='" & Trim(Combo1.Text) & "'", lianjie
  
    List1.Clear
    If yh.RecordCount > 0 Then
        yh.MoveFirst
      
      
        Do Until yh.EOF
            List1.AddItem Trim(yh.Fields("姓名"))
            yh.MoveNext
        Loop
    End If
    Text1 = ""
    Text2 = ""


End Sub



Private Sub Command1_Click()
If Combo1.Text = "系统管理员" Then
    MsgBox "不能增加系统管理员!", vbInformation, "提示"
 
  Else



Text1.Locked = False
Text2.Locked = False

Text1 = ""
Text2 = ""


Command1.Enabled = False
Text1.SetFocus

Command1.Visible = False
Command2.Visible = False
Command3.Visible = False


Combo1.Enabled = False
List1.Enabled = False

End If

End Sub

Private Sub Command2_Click()
If Text1.Text = "" Then
 MsgBox "不能修改!请选择用户。", vbInformation, "提示"
Else
Text1.Locked = False
Text2.Locked = False

Command2.Enabled = False
Command4.Enabled = True
Text1.SetFocus

Command1.Visible = False
Command2.Visible = False
Command3.Visible = False


Combo1.Enabled = False
List1.Enabled = False
End If

End Sub



Private Sub Command3_Click()
If Combo1.Text = "系统管理员" Then
    MsgBox "不能删除系统管理员!", vbInformation, "提示"
 
  Else


  If Text1.Text = "" Then
     MsgBox "不能删除!请选择用户。", vbInformation, "提示"
  Else

  Command3.Enabled = False
  Command4.Enabled = True
  Command4.SetFocus

  Command1.Visible = False
  Command2.Visible = False
  Command3.Visible = False
  
  Combo1.Enabled = False
  List1.Enabled = False
  End If
End If

End Sub

Private Sub Command4_Click()
If Trim(Text1.Text) <> "" And Trim(Text2.Text) <> "" Then


If Command1.Enabled Then
Else
   
    yh.AddNew
 
    yh.Fields("姓名") = Trim(Text1.Text)
    yh.Fields("密码") = Trim(Text2.Text)
    yh.Fields("权限") = Trim(Combo1.Text)
    yh.Fields("时间") = Date + Time

    yh.Update
    yh.MoveFirst
    List1.Clear
    Do Until yh.EOF
        List1.AddItem Trim(yh.Fields("姓名"))
        yh.MoveNext
    Loop
    MsgBox "增加成功!", vbInformation, "提示"
End If

If Command2.Enabled Then
Else
    yh.Fields("姓名") = Trim(Text1.Text)
    yh.Fields("密码") = Trim(Text2.Text)
    yh.Fields("权限") = Trim(Combo1.Text)
    yh.Fields("时间") = Date + Time


    yh.Update
    yh.MoveFirst
    List1.Clear
    Do Until yh.EOF
        List1.AddItem Trim(yh.Fields("姓名"))
        yh.MoveNext
    Loop
    MsgBox "修改成功!", vbInformation, "提示"
End If

If Command3.Enabled Then
Else
  
    yh.Delete
 
    yh.Update
    yh.MoveFirst
    List1.Clear
    Do Until yh.EOF
        List1.AddItem Trim(yh.Fields("姓名"))
        yh.MoveNext
    Loop
    
    
    MsgBox "删除成功!", vbInformation, "提示"
 
End If

Text1.Text = ""
Text2.Text = ""
Text1.Locked = True
Text2.Locked = True

Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True

Command1.Visible = True
Command2.Visible = True
Command3.Visible = True

Combo1.Enabled = True
List1.Enabled = True


End If

End Sub

Private Sub Command5_Click()
Unload Me

End Sub

Private Sub Command6_Click()
Text1.Text = ""
Text2.Text = ""
Text1.Locked = True
Text2.Locked = True

Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True

Command1.Visible = True
Command2.Visible = True
Command3.Visible = True

Combo1.Enabled = True
List1.Enabled = True
End Sub

Private Sub Form_Load()
   With lianjie
        .ConnectionString = dblianjie
        .Open
   End With
   Set yh = New Recordset
   yh.CursorLocation = adUseClient
   yh.CursorType = adOpenDynamic
   yh.LockType = adLockOptimistic
   
   yh.Open "select * from 权限 where 权限='& quanxian &'", lianjie
  
   
   If yh.RecordCount > 0 Then
      yh.MoveFirst
      List1.Clear
      
      Do Until yh.EOF
        List1.AddItem Trim(yh.Fields("姓名"))
        yh.MoveNext
      Loop
   End If
   Combo1.AddItem "系统管理员"
   Combo1.AddItem "操作员"
  
   Combo1.ListIndex = 0
   
   
   
End Sub

Private Sub Form_Unload(Cancel As Integer)

lianjie.Close

End Sub

Private Sub List1_Click()
yh.MoveFirst
yh.Find "姓名='" & Trim(List1.Text) & "'"

Text1.Text = Trim(yh.Fields("姓名"))

Text2.Text = Trim(yh.Fields("密码"))

End Sub

Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Text1.Text <> "" Then
   Text2.SetFocus

End If


End Sub

Private Sub Text2_GotFocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2)
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Text2.Text <> "" Then
  Command4.SetFocus
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -