listbox focus select using textbox

I'm writing a reference program I want a user to be able to type in a few letters into a textbox and have it send the focus to a word in a listbox that starts with those letters. For example if I were writing a dictionary if the user typed "a" the focus would go to "aarvark" or if they typed "ab" it would go to "abacus" and so forth. I hope I'm doing a good job explaining it, but that's basically all I need it to do. Thanks in advance for the help.
 

brathbone

Member
Licensed User
You could use the KeyPress event for your textbox to inspect the current text and look it up in your list of values. Then when you want to "suggest" a word, you can append the text that would complete your suggestion. Then you could set the selectionstart and selectionend to include only the appended text, so that another keystroke from the user will just overwrite your suggestion and generate a new one.

hth,
 
If I can do that, except for instead of appending the user's text it brings the focus to the word in the listbox that it would suggest, it would be exactly what I need it to do. Thanks for the tip, I'll see what I can do.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…