home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Samples / VB_SMPL / VB_SMPL.ZIP / FINDPRT.EXE / FINDFRST.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1994-04-14  |  3.6 KB  |  125 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Searching with FindFirst method on a whole string or partial string"
  4.    ClientHeight    =   4020
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1500
  7.    ClientWidth     =   7365
  8.    Height          =   4425
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4020
  12.    ScaleWidth      =   7365
  13.    Top             =   1155
  14.    Width           =   7485
  15.    Begin CommandButton Command2 
  16.       Caption         =   "Push to Clear list"
  17.       Height          =   495
  18.       Left            =   360
  19.       TabIndex        =   7
  20.       Top             =   3120
  21.       Width           =   1695
  22.    End
  23.    Begin Frame Frame1 
  24.       Height          =   1935
  25.       Left            =   2760
  26.       TabIndex        =   3
  27.       Top             =   240
  28.       Width           =   2415
  29.       Begin OptionButton Option2 
  30.          Caption         =   "Partial title"
  31.          Height          =   495
  32.          Left            =   240
  33.          TabIndex        =   5
  34.          Top             =   1080
  35.          Value           =   -1  'True
  36.          Width           =   2055
  37.       End
  38.       Begin OptionButton Option1 
  39.          Caption         =   "Whole title"
  40.          Height          =   495
  41.          Left            =   240
  42.          TabIndex        =   4
  43.          Top             =   360
  44.          Width           =   2055
  45.       End
  46.    End
  47.    Begin ListBox List1 
  48.       Height          =   1200
  49.       Left            =   2400
  50.       TabIndex        =   2
  51.       Top             =   2520
  52.       Width           =   4695
  53.    End
  54.    Begin TextBox Text1 
  55.       Height          =   495
  56.       Left            =   5520
  57.       TabIndex        =   0
  58.       Top             =   1080
  59.       Width           =   1455
  60.    End
  61.    Begin CommandButton Command1 
  62.       Caption         =   "Push to Find"
  63.       Height          =   495
  64.       Left            =   5520
  65.       TabIndex        =   1
  66.       Top             =   1800
  67.       Width           =   1455
  68.    End
  69.    Begin Label Label3 
  70.       Caption         =   "Enter string below to search on:"
  71.       Height          =   615
  72.       Left            =   5520
  73.       TabIndex        =   9
  74.       Top             =   360
  75.       Width           =   1455
  76.    End
  77.    Begin Label Label2 
  78.       Caption         =   "Select an option of how you want to search for a title(ie Search on the 'Whole title' or search on the 'Partial title' or first letter or of the title)."
  79.       Height          =   1455
  80.       Left            =   360
  81.       TabIndex        =   8
  82.       Top             =   360
  83.       Width           =   2175
  84.    End
  85.    Begin Label Label1 
  86.       Caption         =   "Results of Search ---->"
  87.       Height          =   375
  88.       Left            =   240
  89.       TabIndex        =   6
  90.       Top             =   2520
  91.       Width           =   2055
  92.    End
  93. Dim a$
  94. Dim c$
  95. Sub Command1_Click ()
  96.  Dim db As database
  97.  Dim ds As dynaset
  98.  Set db = OpenDatabase("C:\vb\biblio.mdb")
  99.  Set ds = db.CreateDynaset("titles")
  100.  If option2.Value = True Then
  101.   a$ = Trim$(text1.Text) + "*"  '*** or
  102.   c$ = "[title] like '" & a$ & "'"
  103.  ElseIf option1.Value = True Then
  104.   a$ = Trim$(text1.Text)      '*** if this one, use '=' and not 'like' below
  105.   c$ = "[title] = '" & a$ & "'"
  106.  End If
  107.  ds.FindFirst c$
  108. Do Until ds.NoMatch
  109.  list1.AddItem " " & ds("Title")
  110.  ds.FindNext c$
  111. End Sub
  112. Sub Command2_Click ()
  113.  list1.Clear
  114.  text1.Text = ""
  115.  text1.SetFocus
  116. End Sub
  117. Sub Option1_Click ()
  118.  option1.Value = True
  119.  option2.Value = False
  120. End Sub
  121. Sub Option2_Click ()
  122.  option2.Value = True
  123.  option1.Value = False
  124. End Sub
  125.