Autocomplete textbox

G

Guest

Hello all!

I'm looking for ideas on implementing a textbox with autocomplete
functionality, just like the one found in Excel.

As the user types values into the textbox a lookup for matching values
is performed. For example lets assume that the user types the character
'1' and that the candidate values are '01', '02', '03', '10', '12' etc.

I need the textbox to display the first candidate value that partially matches
the characters typed ('01'). The cursor should be located at the end of the
user typed value (1|0) and the rest of the text must be selected.
As the user goes on typing, the selected text is replaced with the typed
character and the lookup
is performed again.

I am very close. I use the Textbox.SelectionStart and
Textbox.SelectionLength properties but the problem is that the caret is
allways placed at the end of the selection when I need it to be located at
the begining.

Any Ideas?

Thanks!

PS: I cannot use a combobox!
 
D

dbuchanan

Strider,

You can do this with the ComboBox. It is a very versatile control.
Check out "How to: Create Lookup Tables" in help for one way to do it.
I'm not sure but I think you can hide the drop down arrow and keep the
capability.

Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top