listbox focus select using textbox

Discussion in 'Questions (Windows Mobile)' started by Dr. Feelgood, Feb 13, 2008.

  1. Dr. Feelgood

    Dr. Feelgood Member

    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.
     
  2. brathbone

    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,
     
  3. Dr. Feelgood

    Dr. Feelgood Member

    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.
     
Loading...