|
-
Jul 29th, 2004, 04:00 PM
#1
Autocomplete combobox
You would have thought this would have been a standard feature of the combobox, but MS decided to make it hard on us once again.
I got some code to autocomplete a combobox when typing, but it does not limit to the dropdown list. Does anyone have some code that does this? if not I am going to try to work the code I have to do so, and I will post it once I am done
-
Jul 29th, 2004, 08:28 PM
#2
I wonder how many charact
Well, I solved this in web applications fairly easily.
Basically you construct a regex of the text the user has typed, and it can match the first found item, and autopopulate what it thinks is what the user wants .
So if you press 'S', the regex may find Sunshine as a match, because it only checks the available list items for the length of the text the user has typed. Since Sunshine has an S, it will put Sunshine in the textbox, and then highlight 'unshine'. The highlighted part is the text the user didn't type, but the text you autocompleted. This is necessary so your code knows the difference between what the user typed, and what it autocompleted.
So if the user now press 'u', the process continues (you take the userinput, indentified as the text up to the selection point and search again).
If the user types something that doesn't match any item, i simply consumed the event, disallowing the input.
Now, I HAD to do it that way for web apps, there may be an easy way in Forms applications...
-
Jul 29th, 2004, 09:22 PM
#3
Frenzied Member
Coincidentally, I read this earlier today at VBCity.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|