VB3 How to Quickly Search a List BoxLast reviewed: January 9, 1997Article ID: Q119738 |
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 INFORMATIONThis 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
|
KBCategory: kbprg kbcode
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |