1

I have an application where I have a product search text field. To implement a predictive text like feature, I hid a combo box behind the text box that populates with the appropriate products. That all works fine and dandy. The problem is the cursor does not show on the form while the combo box is dropped. I can still use the cursor to select the results from the combo box, but it is invisible until I click something on the form.

Nick
  • 1,903
  • 2
  • 21
  • 40

3 Answers3

1

Bring the cursor back with:

Cursor.Current = Cursors.Default;
Griknok
  • 384
  • 2
  • 13
1

ComboBox AutoComplete Custom Capabilities

See this accepted answer to this question. Combo box already has an AutoComplete mode. No reason to hide it behind a textbox.

Community
  • 1
  • 1
Ryan Bennett
  • 3,404
  • 19
  • 32
  • 2
    More importantly, I think, is that the **`TextBox`** control has auto-complete capabilities. At least, that's how I read the question. – Cody Gray - on strike Apr 06 '11 at 15:07
  • Yeah I looked at that but I don't want to have the combo box shown, I want it to look like a regular text box. Do you know of a way to hide the arrow on the combo box? That would work great for me if so. – Nick Apr 06 '11 at 15:13
  • @Cody Gray Holy crap, a text box does have autocomplete. Thanks. And let this be a lesson to me to read the properties... – Nick Apr 06 '11 at 15:14
  • @Nick: Yup, [three different styles to chose from](http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.autocompletemode.aspx). My life got much easier when I no longer had to write that code myself each time. – Cody Gray - on strike Apr 06 '11 at 15:17
0

Do you have the combobox dropdown style as DropDownList?

Also why not use the AutoComplete Mode to accomplish predictive text feature

http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.WINDOWS.FORMS.COMBOBOX.AUTOCOMPLETEMODE);k(SYSTEM.WINDOWS.FORMS.COMBOBOX);k(VS.PROPERTIES);k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV3.5%22)&rd=true

Mike
  • 5,918
  • 9
  • 57
  • 94