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

📄 frmfindbook.frm

📁 VB编制的图书管理系统,希望可给朋友们带来帮助.
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmFindBook 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "查找书籍"
   ClientHeight    =   5700
   ClientLeft      =   480
   ClientTop       =   915
   ClientWidth     =   10365
   Icon            =   "frmFindBook.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5700
   ScaleWidth      =   10365
   StartUpPosition =   2  '屏幕中心
   Begin MSComctlLib.ListView lv 
      Height          =   2055
      Left            =   240
      TabIndex        =   17
      Top             =   3360
      Width           =   9855
      _ExtentX        =   17383
      _ExtentY        =   3625
      View            =   3
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      GridLines       =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   15724527
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin VB.Frame Frame1 
      Caption         =   "查找"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3135
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   9855
      Begin VB.Frame Frame3 
         Height          =   135
         Left            =   8040
         TabIndex        =   10
         Top             =   1800
         Width           =   1455
      End
      Begin VB.CommandButton Command3 
         Caption         =   "退  出 (&Q)"
         Height          =   495
         Left            =   8160
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   2280
         Width           =   1215
      End
      Begin VB.Frame Frame2 
         Height          =   1215
         Left            =   1560
         TabIndex        =   7
         Top             =   1920
         Width           =   6015
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            Caption         =   "请任选一个查询条件来查找"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   12
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00000080&
            Height          =   240
            Left            =   1080
            TabIndex        =   11
            Top             =   240
            Width           =   2880
         End
         Begin VB.Label Label3 
            Caption         =   "提示:【书籍名称】查询可输入*来代替多个字符以实现多个记录的查找"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   12
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H000000C0&
            Height          =   495
            Left            =   1080
            TabIndex        =   8
            Top             =   600
            Width           =   3855
         End
      End
      Begin VB.CommandButton Command2 
         Caption         =   "清  空( &C)"
         Height          =   375
         Left            =   8160
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   1200
         Width           =   1215
      End
      Begin VB.CommandButton Command1 
         Caption         =   "查  找 (&F)"
         Height          =   375
         Left            =   8160
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   600
         Width           =   1215
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   3480
         TabIndex        =   4
         Top             =   1200
         Width           =   4095
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   3480
         TabIndex        =   3
         Top             =   600
         Width           =   4095
      End
      Begin VB.Label Label9 
         BackColor       =   &H00808080&
         Caption         =   "Label9"
         Height          =   375
         Left            =   3540
         TabIndex        =   16
         Top             =   1260
         Width           =   4095
      End
      Begin VB.Label Label8 
         BackColor       =   &H00808080&
         Caption         =   "Label8"
         Height          =   375
         Left            =   3540
         TabIndex        =   15
         Top             =   660
         Width           =   4095
      End
      Begin VB.Label Label7 
         BackColor       =   &H00808080&
         Caption         =   "Label7"
         Height          =   495
         Left            =   8220
         TabIndex        =   14
         Top             =   2340
         Width           =   1215
      End
      Begin VB.Label Label6 
         BackColor       =   &H00808080&
         Caption         =   "Label6"
         Height          =   375
         Left            =   8220
         TabIndex        =   13
         Top             =   1260
         Width           =   1215
      End
      Begin VB.Label Label5 
         BackColor       =   &H00808080&
         Caption         =   "Label5"
         Height          =   375
         Left            =   8220
         TabIndex        =   12
         Top             =   660
         Width           =   1215
      End
      Begin VB.Image Image1 
         Height          =   855
         Left            =   480
         Picture         =   "frmFindBook.frx":0442
         Stretch         =   -1  'True
         Top             =   600
         Width           =   855
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "书籍名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00004080&
         Height          =   285
         Left            =   1800
         TabIndex        =   2
         Top             =   1200
         Width           =   1200
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "图书编号"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00004080&
         Height          =   285
         Left            =   1800
         TabIndex        =   1
         Top             =   600
         Width           =   1200
      End
   End
End
Attribute VB_Name = "frmFindBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim strSQL As String
    Dim ADOrs As New Recordset
    Dim ins As Integer, insr As Integer, ins2 As Integer, j As Integer
    
    If Text1.Text = "" And Text2.Text = "" Then MsgBox "查询条件不能全为空!!": Exit Sub
    
    ADOrs.ActiveConnection = ADOcn
    strSQL = "select 书籍信息.书籍编号,书籍信息.书籍名称,书籍信息.书籍类别,书籍信息.作者,书籍信息.出版社,书籍信息.出版日期,书籍信息.登记日期,书籍信息.是否被借出"
    strSQL = strSQL + " from 书籍信息 "
        
    If Text1.Text <> "" Then strSQL = strSQL + "where 书籍信息.书籍编号='" + Text1.Text + "'"

    If Text2.Text <> "" Then strSQL = strSQL
        
    ADOrs.CursorLocation = adUseClient
    ADOrs.Open strSQL
    i = 1
    lv.ListItems.Clear
    Do While Not ADOrs.EOF
    
        If Text2.Text <> "" Then
            ins = InStr(Text2.Text, "*")
            ins2 = InStr(2, Text2.Text, "*")
            insr = InStrRev(Text2.Text, "*")
            
            If ins <> 0 Then
                '当输入字符为:*任意字符*
                If Left(Text2.Text, 1) = "*" And Right(Text2.Text, 1) = "*" And Len(Text2.Text) >= 3 Then
                    For j = 1 To Len(Trim(ADOrs("书籍名称"))) - Len(Text2.Text) + 3
                        If StrComp(Mid(Trim(ADOrs("书籍名称")), j, Len(Text2.Text) - 2), Mid(Trim(Text2.Text), 2, ins2 - 2)) Then
                        
                        Else
                            GoTo xx
                            i = i + 1
                        End If
                    Next j
                    
                End If
                
                '当输入字符为:任意字符*
                If Left(Text2.Text, 1) <> "*" And Right(Text2.Text, 1) = "*" Then
                
                    If StrComp(Left(Trim(ADOrs("书籍名称")), ins - 1), Left(Text2.Text, ins - 1)) Then
                        
                    Else
                        GoTo xx
                        i = i + 1
                    End If
                    
                End If
                
                '当输入字符为:*任意字符
                If Left(Text2.Text, 1) = "*" And Right(Text2.Text, 1) <> "*" Then
                
                    If StrComp(Right(Trim(ADOrs("书籍名称")), Len(Text2.Text) - insr), Right(Trim(Text2.Text), Len(Text2.Text) - insr)) Then
                        
                    Else
                        GoTo xx
                        i = i + 1
                    End If
                    
                End If
    
            Else
            
                '当输入为全名时
                If Trim(ADOrs("书籍名称")) = Trim(Text2.Text) Then
                    GoTo xx
                    i = i + 1
                End If
                
            End If
            
            ADOrs.MoveNext
        End If
    
        If Text1.Text <> "" Then
            GoTo xx
            i = i + 1
            ADOrs.MoveNext
        End If
        
    Loop
    Exit Sub
xx:
    lv.ListItems.Add i, , ADOrs.Fields("书籍编号")
            With lv.ListItems(i)
                .SubItems(1) = ADOrs.Fields("书籍名称") & vbNullString
                .SubItems(2) = ADOrs.Fields("书籍类别") & vbNullString
                .SubItems(3) = ADOrs.Fields("作者") & vbNullString
                .SubItems(4) = ADOrs.Fields("出版社") & vbNullString
                .SubItems(5) = ADOrs.Fields("出版日期") & vbNullString
                .SubItems(6) = ADOrs.Fields("登记日期") & vbNullString
                .SubItems(7) = ADOrs.Fields("是否被借出") & vbNullString
            End With
    ADOrs.Close
End Sub

Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call cmdMouseDown(Command1)
End Sub

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command1.BackColor = &H8000000D
End Sub

Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call cmdMouseUp(Command1)
End Sub

Private Sub Command2_Click()
    Text1.Text = ""
    Text2.Text = ""
End Sub

Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call cmdMouseDown(Command2)
End Sub

Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command2.BackColor = &H8000000D
End Sub

Private Sub Command2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call cmdMouseUp(Command2)
End Sub

Private Sub Command3_Click()
    Unload Me
End Sub

Private Sub Command3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call cmdMouseDown(Command3)
End Sub

Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command3.BackColor = &H8000000D
End Sub

Private Sub Command3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call cmdMouseUp(Command3)
End Sub

Private Sub Form_Load()
    lv.ColumnHeaders.Add , , "书籍编号"
    lv.ColumnHeaders.Add , , "书名"
    lv.ColumnHeaders.Add , , "类别"
    lv.ColumnHeaders.Add , , "作者"
    lv.ColumnHeaders.Add , , "出版社"
    lv.ColumnHeaders.Add , , "出版日期"
    lv.ColumnHeaders.Add , , "登记日期"
    lv.ColumnHeaders.Add , , "是否被借出"

End Sub

Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command1.BackColor = &H8000000F
    Command2.BackColor = &H8000000F
    Command3.BackColor = &H8000000F
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    Text2.Text = ""
    
    If KeyAscii = 13 Then Call Command1_Click
    
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
    Text1.Text = ""
    
    If KeyAscii = 13 Then Call Command1_Click
    
End Sub

⌨️ 快捷键说明

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