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

📄 editbook.frm

📁 本系统是图书管理信息系统一个简单实例。本系统主要有系统管理、图书管理、借书证管理、借书和还书操作、报表打印等模块组成。
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form EditBook 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "编辑修改图书"
   ClientHeight    =   5745
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6855
   Icon            =   "EditBook.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5745
   ScaleWidth      =   6855
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Cancel          =   -1  'True
      Caption         =   "关闭(&C)"
      Height          =   495
      Left            =   5160
      TabIndex        =   18
      Top             =   5160
      Width           =   1455
   End
   Begin VB.Frame Frame2 
      Height          =   135
      Left            =   720
      TabIndex        =   17
      Top             =   4920
      Width           =   5895
   End
   Begin VB.PictureBox Picture2 
      BorderStyle     =   0  'None
      Height          =   1575
      Left            =   240
      ScaleHeight     =   1575
      ScaleWidth      =   6375
      TabIndex        =   13
      Top             =   3360
      Width           =   6375
      Begin VB.CommandButton cmdOkCancel 
         Caption         =   "取消"
         Height          =   735
         Index           =   1
         Left            =   4080
         Picture         =   "EditBook.frx":0442
         Style           =   1  'Graphical
         TabIndex        =   15
         Top             =   720
         Width           =   1455
      End
      Begin VB.CommandButton cmdOkCancel 
         Caption         =   "确定"
         Height          =   735
         Index           =   0
         Left            =   1080
         Picture         =   "EditBook.frx":074C
         Style           =   1  'Graphical
         TabIndex        =   14
         Top             =   720
         Width           =   1455
      End
      Begin VB.Label labFlag 
         AutoSize        =   -1  'True
         Caption         =   "确实要修改当前记录吗?"
         ForeColor       =   &H000000FF&
         Height          =   180
         Left            =   2280
         TabIndex        =   16
         Top             =   240
         Width           =   1980
      End
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   120
      Top             =   4920
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   32
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   7
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "EditBook.frx":0B8E
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "EditBook.frx":0FEE
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "EditBook.frx":144E
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "EditBook.frx":18AE
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "EditBook.frx":1D0E
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "EditBook.frx":216E
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "EditBook.frx":25CE
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.PictureBox Picture1 
      BorderStyle     =   0  'None
      Height          =   1335
      Left            =   360
      ScaleHeight     =   1335
      ScaleWidth      =   6375
      TabIndex        =   11
      Top             =   3360
      Width           =   6375
      Begin MSComctlLib.Toolbar Toolbar1 
         Height          =   870
         Left            =   360
         TabIndex        =   12
         Top             =   240
         Width           =   5175
         _ExtentX        =   9128
         _ExtentY        =   1535
         ButtonWidth     =   1138
         ButtonHeight    =   1376
         Appearance      =   1
         ImageList       =   "ImageList1"
         _Version        =   393216
         BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
            NumButtons      =   12
            BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "最前"
               ImageIndex      =   1
            EndProperty
            BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "前一个"
               ImageIndex      =   2
            EndProperty
            BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "后一个"
               ImageIndex      =   3
            EndProperty
            BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "最后"
               ImageIndex      =   4
            EndProperty
            BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Style           =   4
            EndProperty
            BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Style           =   4
            EndProperty
            BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Style           =   3
            EndProperty
            BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Style           =   3
            EndProperty
            BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Style           =   3
            EndProperty
            BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "修改"
               ImageIndex      =   5
            EndProperty
            BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "删除"
               ImageIndex      =   6
            EndProperty
            BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "查找"
               ImageIndex      =   7
            EndProperty
         EndProperty
         BorderStyle     =   1
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "图书基本信息"
      Height          =   2895
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   6375
      Begin VB.TextBox txtBookNum 
         ForeColor       =   &H00FF0000&
         Height          =   330
         Left            =   1200
         TabIndex        =   5
         Top             =   480
         Width           =   2055
      End
      Begin VB.TextBox txtBookName 
         ForeColor       =   &H00000000&
         Height          =   315
         Left            =   1200
         TabIndex        =   4
         Text            =   "Text1"
         Top             =   1290
         Width           =   2535
      End
      Begin VB.TextBox txtBookChu 
         ForeColor       =   &H00000000&
         Height          =   315
         Left            =   1200
         TabIndex        =   3
         Text            =   "Text1"
         Top             =   2280
         Width           =   2535
      End
      Begin VB.TextBox txtCost 
         ForeColor       =   &H00000000&
         Height          =   315
         Left            =   4800
         TabIndex        =   2
         Text            =   "Text1"
         Top             =   2160
         Width           =   1335
      End
      Begin VB.ComboBox Combo1 
         ForeColor       =   &H00000000&
         Height          =   300
         ItemData        =   "EditBook.frx":2A2E
         Left            =   4800
         List            =   "EditBook.frx":2A30
         TabIndex        =   1
         Text            =   "Combo1"
         Top             =   1320
         Width           =   1335
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "图书编号"
         ForeColor       =   &H000000C0&
         Height          =   180
         Index           =   0
         Left            =   360
         TabIndex        =   10
         Top             =   600
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "书  名"
         ForeColor       =   &H00FF0000&
         Height          =   180
         Index           =   1
         Left            =   360
         TabIndex        =   9
         Top             =   1320
         Width           =   540
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "价  格"
         ForeColor       =   &H00FF0000&
         Height          =   180
         Index           =   2
         Left            =   3960
         TabIndex        =   8
         Top             =   2280
         Width           =   540
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "类  别"
         ForeColor       =   &H00FF0000&
         Height          =   180
         Index           =   3
         Left            =   3960
         TabIndex        =   7
         Top             =   1320
         Width           =   540
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "出版社"
         ForeColor       =   &H00FF0000&
         Height          =   180
         Index           =   4
         Left            =   360
         TabIndex        =   6
         Top             =   2280
         Width           =   540
      End
   End
End
Attribute VB_Name = "EditBook"
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 NumFlag As Boolean
Dim db1 As Database
Dim rst1 As Recordset
Dim i As Integer
Private Sub cmdOkCancel_Click(Index As Integer)
Select Case Index
    Case 0
        If StrFlag = "修改" Then
            rst.Edit
            WriteIn
            rst.Update
            Disp
            Picture2.Visible = False
            Picture1.Visible = True
            SetTxt (False)
        ElseIf StrFlag = "删除" Then
            rst.Delete
            rst.MovePrevious
            If rst.BOF Then rst.MoveNext
            Disp
            Picture2.Visible = False
            Picture1.Visible = True
        End If
    Case 1
        Disp
        Picture2.Visible = False
        Picture1.Visible = True
        SetTxt (False)
End Select
End Sub

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Load()
Set db = Workspaces(0).OpenDatabase(App.Path & "\DataBase\BookMIS.mdb", False)
Set rst = db.OpenRecordset("Book", dbOpenTable)
rst.Index = "图书编号"

Set db1 = Workspaces(0).OpenDatabase(App.Path & "\DataBase\BookMIS.mdb", False)
Set rst1 = db1.OpenRecordset("Type", dbOpenTable)

Rec = rst.RecordCount
If Rec = 0 Then
    Toolbar1.Enabled = False
    SetTxt (False)
End If
SetTxt (False)
rst.MoveFirst
Disp
TypeAdd
Picture1.Visible = True
Picture2.Visible = False
NumFlag = False
End Sub
Private Sub Disp()
txtBookNum = rst.Fields("图书编号") & vbNullString
txtBookName = rst.Fields("书名") & vbNullString
txtCost = rst.Fields("价格") & Empty
txtBookChu = rst.Fields("出版社") & vbNullString
Combo1.Text = rst.Fields("类别") & vbNullString
End Sub
Private Sub Kong()
txtBookNum = ""
txtBookName = ""
txtBookChu = ""
Combo1.Text = ""
End Sub
Private Sub SetTxt(Bool As Boolean)
txtBookNum.Enabled = Bool
txtCost.Enabled = Bool
txtBookName.Enabled = Bool
txtBookChu.Enabled = Bool
Combo1.Enabled = Bool
End Sub

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

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
    Case 1
        rst.MoveFirst
        Disp
    Case 2
        rst.MovePrevious
        If rst.BOF Then
            rst.MoveNext
            Exit Sub
        End If
        Disp
    Case 3
        rst.MoveNext
        If rst.EOF Then
            rst.MovePrevious
            Exit Sub
        End If
        Disp
    Case 4
        rst.MoveLast
        Disp
    Case 10
        StrFlag = "修改"
        SetTxt (True)
        labFlag.Caption = "您确实要修改当前记录吗?"
        Picture1.Visible = False
        Picture2.Visible = True
    Case 11
        StrFlag = "删除"
        labFlag.Caption = "您确实要删除当前记录吗?"
        Picture1.Visible = False
        Picture2.Visible = True
    Case 12
        SearchNum.Show (1)
        If SearchFlag = True Then
            rst.Seek "=", BookBianHao
            If rst.NoMatch Then
                MsgBox "没有此图书编号!", 0 + 48, "查找失败"
                Exit Sub
            End If
            Disp
            SearchFlag = False
        End If
End Select
End Sub
Private Sub WriteIn()
rst.Fields("图书编号") = txtBookNum
rst.Fields("书名") = txtBookName
rst.Fields("价格") = Val(txtCost)
rst.Fields("出版社") = txtBookChu
rst.Fields("类别") = Combo1.Text
End Sub
Private Sub TypeAdd()
rst1.MoveLast
rst1.MoveFirst
For i = 1 To rst1.RecordCount
    Combo1.AddItem rst1.Fields("类别")
    rst1.MoveNext
    If rst1.EOF Then Exit Sub
Next
End Sub

⌨️ 快捷键说明

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