We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Autocomplete - Assigning New Datasource At Runtime

Thread ID:

Created:

Updated:

Platform:

Replies:

95354 Jul 2,2010 01:22 PM Jul 5,2010 10:37 AM Windows Forms 1
loading
Tags: Tools
JD West
Asked On July 2, 2010 01:22 PM

Is it possible to set the datasource of an Autocomplete to a completely different dataset at runtime?

The datasets have different numbers of columns.

I tried making two different autocompletes on the form.

But, is it possible to "attach" the or set the disabled/enabled for an autocomplete in code for a particular control or must it only be done at designtime in the GUI?

Thanks.

Lingaraj S [Syncfusion]
Replied On July 5, 2010 10:37 AM

Hi JD West,

Thank you for your interest in Syncfusion products.

Yes. You can achieve by using SetAutoComplete method in AutoComplete as shown below

private void Form1_Load(object sender, EventArgs e)
{
DataTable dt1 = new DataTable();
dt1.Columns.Add("Col1");
dt1.Columns.Add("Col2");
for (int i = 0; i < 10; i++)
{
dt1.Rows.Add(new object[] { i, 1 });
}
DataTable dt2 = new DataTable();
dt2.Columns.Add("Col1");
dt2.Columns.Add("Col2");
dt2.Columns.Add("Col3");
for (int i = 0; i < 10; i++)
{
dt2.Rows.Add(new object[] { i, 1 ,2});
}
this.autoComplete1.DataSource = dt1;
this.autoComplete2.DataSource = dt2;
this.autoComplete1.SetAutoComplete(this.textBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteModes.AutoSuggest);
this.autoComplete2.SetAutoComplete(this.textBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteModes.Disabled);
}
private void button1_Click(object sender, EventArgs e)
{
this.autoComplete1.SetAutoComplete(this.textBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteModes.Disabled);
this.autoComplete2.SetAutoComplete(this.textBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteModes.AutoSuggest);
}
private void button2_Click(object sender, EventArgs e)
{
this.autoComplete1.SetAutoComplete(this.textBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteModes.AutoSuggest);
this.autoComplete2.SetAutoComplete(this.textBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteModes.Disabled);
}


Also please refer the documentation from following link.
http://help.syncfusion.com/ug_82/WindowsFormsUI_Tools/EnablingAutoCompleteInTextBoxArea.html

Please let me know if you have any queries.

Regards,
Lingaraj S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;