views:

51

answers:

2

I am using the AutoComplete properties on a textbox (actually a ToolStripTextBox). This is working fine except it doesn't show until I type at lease one character. How do I make it so the suggestions are shown even if the textbox is empty?

Mode = Suggest
Source = CustomSource

Source set progamatically and limited to 10 items

Alternatively if someone knows how to force the suggestions to show programatically on the OnEnter event that might be a solution

+1  A: 

I'm not sure if there's any solution for this, especially since the suggestion box will automatically close if you delete all text in the TextBox.

A workaround might be to have ComboBox overlap the TextBox and you can have that show all the options but if one of them are selected or if something is typed you automatically switch to the TextBox and show that instead.
Though I'd suggest that in this scenario I'd probably consider getting rid of the TextBox altogether and just stick with a ComboBox since that's what it's there for.

To show the dropdown programmatically in a ComboBox look at the SendMessage API and the message CB_SHOWDROPDOWN (and if I remember correctly you can use the same API/message but with different parameters to close it programmatically if that's needed as well).

ho1
+1  A: 

There is no such possibility in .net api. Even more there is no such possibility in IAutoComplete shell interface which .net is using internally.

So you should live with it, or implement you own auto-complete behaviour without using default one. You can use combo-box drop-down as previously suggested, or even create your own auto-complete control (in my application I chosen the last variant).

arbiter