VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



ListLookup (Autocomplete ComboBox Function)

by Matthew K. Johnson (1 Submission)
Category: OLE/COM/DCOM/Active-X
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

By placing a reference to this module (single sub, no API) in a ComboBox_KeyPress event, the combobox will search the list for a match and offer an autocomplete.
Options include allowing for a case-sensitive search and allowing the user to only select from items located in the list (like a Dropdown List)
Backspace key and deleting of highlighted text is supported.
Based on Mike Schaffer's IncrLookup [page 28 of the Visual Basic Source Code Library]. API Call was removed and replaced with a local function, boolean options added, backspace support added, documentation added.
Extensive documentation included in module, including usage and line by line commenting (if VBC's parser puts in extra CR's, it's will get ugly)
Developed and Tested in VB 6. Nothing complex, so it should work in any version, but not tested.

Inputs
Ascii keystroke (as integer) entered. Optional Boolean for acting as a Dropdown List. Optional Boolean for case-sensitive search.
Assumes
Extensive documentation included in module, including usage and line by line commenting (if PSC's parser puts in extra CR's, it's will get ugly) Developed and Tested in VB 6. Nothing complex, so it should work in any version, but not tested.
Code Returns
Nothing. (ComboBox object is modified)
Side Effects
1)User must use a Dropdown Combo or Dropdown list. 2) Delete key is not currently supported fully. 3) When acting as a dropdown list, the user can delete the seleted entry and leave blank.
API Declarations
None.

Rate ListLookup (Autocomplete ComboBox Function)

Download ListLookup (Autocomplete ComboBox Function)

Download ListLookup (Autocomplete ComboBox Function) (3 KB)

ListLookup (Autocomplete ComboBox Function) Comments

No comments have been posted about ListLookup (Autocomplete ComboBox Function). Why not be the first to post a comment about ListLookup (Autocomplete ComboBox Function).

Post your comment

Subject:
Message:
0/1000 characters