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

📄 frmsearch.frm

📁 个人记事本
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSearch 
   Caption         =   "查找"
   ClientHeight    =   1440
   ClientLeft      =   3300
   ClientTop       =   1950
   ClientWidth     =   5595
   Icon            =   "frmSearch.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1440
   ScaleWidth      =   5595
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton CmdSearchNext 
      Caption         =   "查找下一个(&N)"
      Height          =   375
      Left            =   3840
      TabIndex        =   5
      Top             =   180
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.CheckBox CheckAllMatch 
      Caption         =   " 全匹配"
      Height          =   255
      Left            =   1440
      TabIndex        =   4
      Top             =   840
      Width           =   975
   End
   Begin VB.CommandButton CmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   375
      Left            =   3840
      TabIndex        =   3
      Top             =   840
      Width           =   1455
   End
   Begin VB.CommandButton CmdSearch 
      Caption         =   "查找(&S)"
      Default         =   -1  'True
      Height          =   375
      Left            =   3840
      TabIndex        =   2
      Top             =   180
      Width           =   1455
   End
   Begin VB.ComboBox Combo 
      Height          =   300
      Left            =   1440
      TabIndex        =   1
      Top             =   210
      Width           =   2175
   End
   Begin VB.Image Image1 
      Height          =   960
      Left            =   240
      Picture         =   "frmSearch.frx":08CA
      Top             =   480
      Width           =   960
   End
   Begin VB.Label Label1 
      Caption         =   "查找主题:"
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   975
   End
End
Attribute VB_Name = "frmSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim LastPosition As String

Private Sub CmdCancel_Click()
    Unload Me
End Sub

Private Sub CmdSearch_Click()
    Dim equal As Boolean
    equal = False
    For i = 0 To n - 1
        If Combo.Text = Search(i) Then equal = True
    Next
    If Not equal Then
        Combo.AddItem Combo.Text, n
        Search(n) = Combo.Text
        n = n + 1
    End If

    With ActiveForm.Data1.Recordset
        If Trim(Combo.Text) <> "" Then
            LastPosition = .Bookmark
            If CheckAllMatch.Value = 1 Then
                .FindFirst "[主题] like" & "'" & Trim(Combo.Text) & "'"
            Else
                .FindFirst "[主题] like" & "'*" & Trim(Combo.Text) & "*'"
            End If
            If .NoMatch Then
                MsgBox "数据库中不存在" & "主题为 '" & Trim(Combo.Text) & "' 的记录!"
                .Bookmark = LastPosition
                Exit Sub
            Else
                LastPosition = .Bookmark
                CmdSearch.Visible = False
                CmdSearchNext.Visible = True
            End If
        Else
            MsgBox "请输入要查找的书名!", vbExclamation
            Combo.SetFocus
        End If
    End With
End Sub

Private Sub CmdSearchNext_Click()
    With ActiveForm.Data1.Recordset
    If Trim(Combo.Text) <> "" Then
        LastPosition = .Bookmark
        If CheckAllMatch.Value = 1 Then
            .FindNext "[主题] like" & "'" & Trim(Combo.Text) & "'"
            Else
            .FindNext "[主题] like" & "'*" & Trim(Combo.Text) & "*'"
        End If
        If .NoMatch Then
            MsgBox "已搜索到数据库末了!"
            .Bookmark = LastPosition
            Exit Sub
        Else
            LastPosition = .Bookmark
            CmdSearch.Enabled = False
        End If
    Else
        MsgBox "请输入要查找的书名!", vbExclamation
        Combo.SetFocus
    End If
    End With
End Sub

Private Sub Combo_Change()
    CmdSearch.Visible = True
    CmdSearchNext.Visible = False
End Sub

Private Sub Form_Load()
    For i = 0 To n - 1
        Combo.AddItem Search(i), i
    Next
End Sub

⌨️ 快捷键说明

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