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

📄 frmsearch.frm

📁 <Visual Basic 数据库开发实例精粹(第二版)>一书首先介绍了Visual Basic(简称VB)开发的技巧和重点技术
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSearch 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "查找客户"
   ClientHeight    =   2370
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   5520
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2370
   ScaleWidth      =   5520
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame1 
      Caption         =   "查找客户"
      Height          =   1335
      Left            =   480
      TabIndex        =   2
      Top             =   240
      Width           =   4695
      Begin VB.ComboBox cboType 
         Height          =   300
         ItemData        =   "frmSearch.frx":0000
         Left            =   1680
         List            =   "frmSearch.frx":0002
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   750
         Width           =   1815
      End
      Begin VB.TextBox txtName 
         Height          =   300
         Left            =   1680
         TabIndex        =   3
         Top             =   300
         Width           =   1815
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "客户类型"
         Height          =   180
         Left            =   600
         TabIndex        =   6
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "姓名"
         Height          =   180
         Left            =   600
         TabIndex        =   5
         Top             =   360
         Width           =   360
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   3840
      TabIndex        =   1
      Top             =   1800
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Height          =   375
      Left            =   2520
      TabIndex        =   0
      Top             =   1800
      Width           =   1215
   End
End
Attribute VB_Name = "frmSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Private OK As Boolean             '确定用户按了OK还是CANCEL按钮
Private mvarSearchName As String  '查找的客户名称
Private mvarTypeId As Long        '客户类型ID

'查找的客户名称
Public Property Get SearchName() As String
  SearchName = mvarSearchName
End Property

'客户类型ID
Public Property Get TypeId() As Long
  TypeId = mvarTypeId
End Property

Private Sub CancelButton_Click()
  OK = False
  Me.Hide
End Sub

Private Sub Form_Load()
  '将所有客户类型添加到组合框中
  AllClientsTypeToCombo cboType
  
  cboType.AddItem "全部类型", 0
  cboType.ItemData(0) = 0
  
  cboType.ListIndex = 0
  
End Sub

'显示查找对话框
Public Function RetriveSearch(Optional nTypeID As Long = -1) As Boolean
  Me.Show vbModal
  If OK = False Then Exit Function
  
  RetriveSearch = True
  
  Unload Me
End Function

Private Sub OKButton_Click()
  OK = True
  
  mvarSearchName = txtName.Text
  mvarTypeId = cboType.ItemData(cboType.ListIndex)
  Me.Hide

End Sub

⌨️ 快捷键说明

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