Results 1 to 2 of 2

Thread: Simple Search for a bound HFlexGrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Brooklyn, New York
    Posts
    1

    Unhappy Simple Search for a bound HFlexGrid

    Hi:

    I have a combo box and a search button on my form. The user is suppossed to type something into the combo box and click on the search button to initiate the search. The search is supposed to use the InStr function.

    I'm using a Combo list box because the box is suppossed to retain the string that was searched for.

    What is the simplest and fastest code to accomplish this?

  2. #2
    Hyperactive Member brenaaro's Avatar
    Join Date
    Sep 2001
    Location
    Montreal, Canada
    Posts
    391
    Make sure the combo box's Style is set to 0.

    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim I As Integer
    3.     Dim s As String
    4.    
    5.     s = Combo1.Text
    6.    
    7.     For I = 1 To Combo1.ListCount
    8.        
    9.         If CBool(InStr(1, Combo1.List(I), s)) Then
    10.             Combo1.ListIndex = I
    11.             Exit For
    12.         End If
    13.        
    14.     Next I
    15.    
    16. End Sub
    And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width