How to Quickly Search a List BoxLast reviewed: January 10, 1996Article ID: Q141027 |
The information in this article applies to:
SUMMARYA popular item in a user interface is to "link" a text box to a list box so that as the user types text into the text box, the nearest match in the list box is selected. Although this technique can be implemented fairly easily using pure Visual Basic code, the Windows API provides a quick and easy way of doing this.
MORE INFORMATIONThe following technique uses the LB_FINDSTRING message for a list box to locate a partial match for a string in a list box. To do this, call the Windows API SendMessage function. The SendMessage function requires the following parameters to list the files:
SendMessage (hWnd,LB_FINDSTRING, wParam, lparam)where
hWnd is the hWnd of the list box.wParam is an integer that specifies the starting point for the search. Use -1 to search the whole list box. Lparam is a long pointer to the string to find. Example to Demonstrate Searching a List Box
|
Additional reference words: 4.00 vb4win vb4all
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |