Hi,
I have an auto complete box as search box in my application. i bind it with a list that comes from the service. When i enter any test it has to display the intellisense list that matches the text in the auto complete box.
How to do that. Please help.
Thanks,
Vijay
Loading
Karthik AgarwalPosted Dec 15, 2011, 8:45 AM
{
public partial class AutoComplete : Form
{
public List
public AutoComplete()
{
str.Add("one");
str.Add("two");
str.Add("three");
str.Add("four");
str.Add("five");
str.Add("six");
InitializeComponent();
}
}
}
The above code should be in Auto.cs file
and where as in the Auto.designer.cs file you should do like this:
for (int i = 0; i < str.Count; i++)
{
this.textBox1.AutoCompleteCustomSource.Add(str[i]);
}
this.textBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append;
this.textBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
this.textBox1.Location = new System.Drawing.Point(70, 12);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(244, 20);
this.textBox1.TabIndex = 0;
which should do the job?
Karthik AgarwalPosted Dec 15, 2011, 8:28 AM
"one",
"two",
"three",
"four",
"five",
"six",
"seven"});
this.textBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append;
this.textBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
Instead of the string in the above code add your list from which you want to get strings.