I want to have a textbox control that suggests and append values from a database in a Windows application with C# 2008 and LINQ.
I do it with a combobox but I can't do it with a textbox.
How do I do it?
I want to have a textbox control that suggests and append values from a database in a Windows application with C# 2008 and LINQ.
I do it with a combobox but I can't do it with a textbox.
How do I do it?
You only need to call this once after you have your data needed for the autocomplete list. Once bound it stays with the textBox. You do not need to or want to call it every time the text is changed in the textBox, that will kill your program.
This might not be the best way to do things, but should work:
Check out the
AutoCompleteSource
,AutoCompleteCustomSource
andAutoCompleteMode
properties.Note that the designer allows you to do that without writing any code...
There are two ways to accomplish this textbox effect:
Either using the graphic user interface (GUI); or with code
Using the Graphic User Interface:
Go to: "Properties" Tab; then set the following properties:
However; the best way is to create this by code. See example below.