Results 1 to 4 of 4

Thread: Combo matching on more than on character

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Location
    Muscatine, Iowa, USA
    Posts
    18

    Post

    i have a number of combo boxes from diferrent tables on a form that I'm using ADO to populate and Then depending on the selection by the user, I write the value to the current Table. I would like to be able to cut down the search as the person starts keying in the data. For example as a person keys in "J" cutout everything that doesn't start with "J", then if he keys in "JO" cut out everything that doesn't start with "JO" and so on. Thanks

  2. #2
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Try this code, I have this set up where this code is in the text1_Change event, but you may be able to play around with it a bit to get it to work with Combo boxes.

    Code:
    list1.ListIndex = SendMessage(listTables.hWnd, LB_FINDSTRING, -1, ByVal txtViewTable.Text)
    Good luck, and let me know what you changed to get it to work with Combo boxes.

    ------------------
    Ryan
    [email protected]
    ICQ# 47799046



    [This message has been edited by Gimpster (edited 12-27-1999).]

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Gimpster's code requires an API declaration.... add this to a module

    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    Let us know if this is the wrong one, gimpster

    Tom

  4. #4
    Member
    Join Date
    Dec 1999
    Posts
    37

    Post

    You can use SendMessageByString API to the window handle of the Combo Box. Assuming that you have the ComboBox's window handle.

    Code:
    Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long 
    Private Const CB_FINDSTRING = &H14C
    
    moCbo.ListIndex = SendMessageByString(moCbo.hwnd, CB_FINDSTRING, -1, txtViewTable.Text)
    Ruchi

    [This message has been edited by Ruchi (edited 12-28-1999).]

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