How to make autocompleting textbox in VB6?
I want to have an auto-completing textbox like the one in the image below:
This screenshot is from an accounting software. Whenever the user focuses on a textbox and starts typing something, the suggestions just pop up under the control (as seen in the image under the Purc type textbox). This auto-suggest functionality even works in the cells of the grid shown in the picture. Moreover, the fields in which this a开发者_如何学Cuto-suggest is enabled allow only values from the auto-suggest list to be filled up and nothing else.
I want to emulate similar functionality in my app in VB6. Any ideas on how to implement auto-completing textbox in VB6?
Checkout the AutoComplete Text Box at FreeVBCode.com.
Another option is at VBNet. The article shows how to use shlwapi.dll api.
What I've typically done is do what is included in the project link by C-Pound Guru. Take a TextBox and as the user types into the field have a ListBox fill with results matching the text. The ListBox would by default be hidden but will be made visible when text is entered into the field. When the ListBox is clicked then simply update the TextBox with the ListBox's selected item text then hide the ListBox control again. A quite simple routine to complete.
VBAccelerator is an excellent site for VB6 tips - try their AutoComplete sample
精彩评论