Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Predictive Text in Text Box

Status
Not open for further replies.

bobbarker

Programmer
Dec 20, 2001
83
0
0
GB
I have a text box control.

When a value is keyed in the text box I want the remainder of the text to be filled in from a look up.

For example I have an array with 3 items:
"BOB"
"BOB BARKER"
"BOB BAXTER"

When the user keys "BO" I want to go through the array and complete the text box with the first match found reading from the left - i.e. "BOB"
Or if the user was to key "BOB BA" the text box would complete to "BOB BARKER"
Or if the user was to key "BOB BAX" the text box would complete to "BOB BAXTER"

I'm OK with navigating around the array etc but what I am unsure of is where to capture and process the keypresses.

I am guessing in the text box Key Up Event? But if the user presses tab to move to the next control, the key press does not seem to be not processed and the cursor does not move on. I don't really want to have to code what should happen for all key presses - e.g. if tab pressed then txtNext.SetFocus

Hope you can help.
 
Do a search in this forum for autocomplete.



Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Um, silly question, but why not just use a combobox?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top