Results 1 to 4 of 4

Thread: search "a" automatically output all starts from "a..."

  1. #1

    Thread Starter
    Fanatic Member noielen's Avatar
    Join Date
    Nov 2005
    Location
    Cebu, Phil.
    Posts
    680

    Exclamation search "a" automatically output all starts from "a..."

    somebody can help me on how to write a code in vb search... for example i have a textbox1 and a listbox, the user search in the textbox1 field input data "a" then the listbox automatically higlight the value that starts "a..."? i know this is very easy for you. can u share it with me... tnx in advance.
    noister
    <advertising link removed by moderator>

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: search "a" automatically output all starts from "a..."

    Try a search for 'Listbox Autocomplete' as there are a few different approaches

  3. #3

    Thread Starter
    Fanatic Member noielen's Avatar
    Join Date
    Nov 2005
    Location
    Cebu, Phil.
    Posts
    680

    Re: search "a" automatically output all starts from "a..."

    Bruce! 'Listbox Autocomplete' is another component to use? can u provide more complete info. but tnx...

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: search "a" automatically output all starts from "a..."

    Quote Originally Posted by noielen
    Bruce! 'Listbox Autocomplete' is another component to use? can u provide more complete info. but tnx...
    No, it is code. Here is an example using a textbox to autocomplete searching a ListBox.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    4. (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    5. lParam As Any) As Long
    6.  
    7. Private Const LB_FINDSTRING = &H18F
    8.  
    9. 'Add a textbox above the listbox.   Call it txtSearch
    10. Private Sub txtSearch_Change()
    11. List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, -1, ByVal CStr(txtSearch.Text))
    12. End Sub

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