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

📄 settype.frm

📁 电气设备管理系统信息在社会和经济的发展中所起的作用越来越为人们所重视。信息资源的开发利用水平成为衡量一个国家综合国力的重要标志之一
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form SetType 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "设置信息类别"
   ClientHeight    =   2835
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3510
   Icon            =   "SetType.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2835
   ScaleWidth      =   3510
   StartUpPosition =   2  '屏幕中心
   Begin MSComctlLib.ListView Lv 
      Height          =   1800
      Left            =   45
      TabIndex        =   1
      Top             =   45
      Width           =   3390
      _ExtentX        =   5980
      _ExtentY        =   3175
      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        =   2
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "类别"
         Object.Width           =   2469
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "允许天数"
         Object.Width           =   2540
      EndProperty
   End
   Begin VB.CommandButton cmdDelete 
      BackColor       =   &H00FFFFFF&
      Caption         =   "删除"
      Height          =   375
      Left            =   2220
      Style           =   1  'Graphical
      TabIndex        =   12
      Top             =   2190
      Width           =   1035
   End
   Begin VB.CommandButton cmdEdit 
      BackColor       =   &H00FFFFFF&
      Caption         =   "修改"
      Height          =   375
      Left            =   1200
      Style           =   1  'Graphical
      TabIndex        =   13
      Top             =   2190
      Width           =   1035
   End
   Begin VB.CommandButton cmdAdd 
      BackColor       =   &H00FFFFFF&
      Caption         =   "添加"
      Height          =   375
      Left            =   180
      Style           =   1  'Graphical
      TabIndex        =   14
      Top             =   2190
      Width           =   1035
   End
   Begin VB.PictureBox Picture2 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      ForeColor       =   &H80000008&
      Height          =   2835
      Left            =   0
      ScaleHeight     =   2805
      ScaleWidth      =   3480
      TabIndex        =   2
      Top             =   0
      Width           =   3510
      Begin VB.CommandButton cmdSaveCancel 
         BackColor       =   &H00FFFFFF&
         Caption         =   "取消"
         Height          =   330
         Index           =   1
         Left            =   2385
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   1485
         Width           =   840
      End
      Begin VB.CommandButton cmdSaveCancel 
         BackColor       =   &H00FFFFFF&
         Caption         =   "保存"
         Height          =   330
         Index           =   0
         Left            =   1560
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   1485
         Width           =   840
      End
      Begin VB.Frame Frame1 
         BackColor       =   &H005CE764&
         Height          =   60
         Left            =   -75
         TabIndex        =   7
         Top             =   1890
         Width           =   3555
      End
      Begin MSComCtl2.UpDown UpD 
         Height          =   285
         Left            =   1410
         TabIndex        =   6
         Top             =   1080
         Width           =   240
         _ExtentX        =   423
         _ExtentY        =   503
         _Version        =   393216
         BuddyControl    =   "comTime"
         BuddyDispid     =   196615
         OrigLeft        =   1920
         OrigTop         =   1440
         OrigRight       =   2145
         OrigBottom      =   1695
         Max             =   1000
         SyncBuddy       =   -1  'True
         BuddyProperty   =   0
         Enabled         =   -1  'True
      End
      Begin VB.ComboBox comTime 
         Height          =   300
         ItemData        =   "SetType.frx":058A
         Left            =   330
         List            =   "SetType.frx":05A3
         TabIndex        =   5
         Top             =   1080
         Width           =   1095
      End
      Begin VB.TextBox txtTypeName 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   330
         TabIndex        =   0
         Top             =   435
         Width           =   1815
      End
      Begin VB.Image Image2 
         Height          =   240
         Left            =   75
         Picture         =   "SetType.frx":05C7
         Top             =   120
         Width           =   240
      End
      Begin VB.Image Image1 
         Height          =   240
         Left            =   60
         Picture         =   "SetType.frx":0B51
         Top             =   795
         Width           =   240
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "天"
         Height          =   180
         Left            =   1755
         TabIndex        =   11
         Top             =   1170
         Width           =   180
      End
      Begin VB.Label labFlag 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "添加"
         ForeColor       =   &H000000C0&
         Height          =   180
         Left            =   2940
         TabIndex        =   10
         Top             =   60
         Width           =   360
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "可占用时间"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   1
         Left            =   345
         TabIndex        =   4
         Top             =   810
         Width           =   1050
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "类别名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   0
         Left            =   315
         TabIndex        =   3
         Top             =   150
         Width           =   840
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H00D0D0D0&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   900
         Left            =   -75
         Top             =   1935
         Width           =   3585
      End
   End
   Begin VB.Menu MainMnu 
      Caption         =   "MainMnu"
      Visible         =   0   'False
      Begin VB.Menu AddMnu 
         Caption         =   "添加新类别(&A)"
         Shortcut        =   ^A
      End
      Begin VB.Menu EditMnu 
         Caption         =   "编辑类别(&E)"
         Shortcut        =   ^E
      End
      Begin VB.Menu s1 
         Caption         =   "-"
      End
      Begin VB.Menu DeleteMnu 
         Caption         =   "删除类别(&D)"
         Shortcut        =   ^D
      End
      Begin VB.Menu ShowMnu 
         Caption         =   "显示所有类别(&S)"
         Shortcut        =   ^S
      End
      Begin VB.Menu s2 
         Caption         =   "-"
      End
      Begin VB.Menu ExitMnu 
         Caption         =   "退出(&X)"
         Shortcut        =   ^X
      End
   End
End
Attribute VB_Name = "SetType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim rst As Recordset
Dim Rec As Integer
Dim StrFlag As String
Dim Se As Integer

Private Sub AddMnu_Click()
CmdAdd_Click
End Sub

Private Sub CmdAdd_Click()
StrFlag = "添加"
labFlag.Caption = "添加状态"
txtTypeName = ""
comTime = ""
Lv.Visible = False
Picture2.Visible = True
cmdFlag (False)
End Sub
Private Sub cmdDelete_Click()
Dim St As String
rst.Seek "=", Lv.SelectedItem.Text
St = "确实要删除 " & Lv.SelectedItem.Text & " 类吗?"
If MsgBox(St, 4 + 32, "删除类别") = vbYes Then
    rst.Delete
    Disp
Else
    Exit Sub
End If
End Sub
Private Sub cmdEdit_Click()
StrFlag = "编辑"
labFlag.Caption = "修改状态"
Se = Lv.SelectedItem.Index
rst.Seek "=", Lv.SelectedItem.Text
txtTypeName.Text = rst.Fields("类别")
comTime.Text = rst.Fields("借出天数")
Picture2.Visible = True
Lv.Visible = False
cmdFlag (False)
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdSaveCancel_Click(Index As Integer)
Select Case Index
    Case 0
    If StrFlag = "添加" Then
        If txtTypeName.Text = "" Or comTime.Text = "" Then
            MsgBox "请填写完整!", 0 + 48, "提示"
            Exit Sub
        End If
        rst.Seek "=", Trim(txtTypeName)
        If rst.NoMatch = False Then
            MsgBox txtTypeName & " 类别已经存在,请填写其它类!", 0 + 48, "类别重复"
            txtTypeName.SetFocus
            Exit Sub
        End If
        rst.AddNew
        rst.Fields("类别") = Trim(txtTypeName.Text) & vbNullString
        rst.Fields("借出天数") = Trim(comTime.Text) & vbNullString
        rst.Update
        Picture2.Visible = False
        Lv.Visible = True
        Disp
        cmdFlag (True)
    ElseIf StrFlag = "编辑" Then
        If txtTypeName.Text = "" Or comTime.Text = "" Then
            MsgBox "请填写完整!", 0 + 48, "提示"
            Exit Sub
        End If
        rst.Edit
        rst.Fields("类别") = Trim(txtTypeName.Text) & vbNullString
        rst.Fields("借出天数") = Trim(comTime.Text)
        rst.Update
        Picture2.Visible = False
        Lv.Visible = True
        Disp
        cmdFlag (True)
    End If
    Case 1
        Picture2.Visible = False
        Lv.Visible = True
        cmdFlag (True)
End Select
End Sub

Private Sub DeleteMnu_Click()
cmdDelete_Click
End Sub

Private Sub EditMnu_Click()
cmdEdit_Click
End Sub

Private Sub ExitMnu_Click()
cmdExit_Click
End Sub

Private Sub Form_Load()
Lv.Visible = True
Picture2.Visible = False
Set db = Workspaces(0).OpenDatabase(App.Path & "\Database\Data.mdb", False)
Set rst = db.OpenRecordset("Type", dbOpenTable)
rst.Index = "类别"
Disp
End Sub
Private Sub Disp()
Lv.ListItems.Clear
rst.MoveLast
Rec = rst.RecordCount
rst.MoveFirst
For i = 1 To Rec
    Lv.ListItems.Add i, , rst.Fields("类别")
    Lv.ListItems(i).SubItems(1) = rst.Fields("借出天数")
    rst.MoveNext
    If rst.EOF Then Exit For
Next
End Sub
Private Sub cmdFlag(Bool As Boolean)
cmdAdd.Enabled = Bool
cmdDelete.Enabled = Bool
'cmdExit.Enabled = Bool
cmdEdit.Enabled = Bool
End Sub

Private Sub Form_Unload(Cancel As Integer)
rst.Close
db.Close
End Sub

Private Sub Lv_DblClick()
cmdEdit_Click
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 ShowMnu_Click()
Disp
End Sub

⌨️ 快捷键说明

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