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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

If a new DataRow is added to the DataTable during runtime, then how can I trigger the update?

 

You need to call this.autoComplete1.SetTableData() method which sets the internal table data based on the AutoComplete control's DataSource property.

C#

DataTable dt;

private void Form1_Load(object sender, System.EventArgs e)

{

dt=new DataTable("select");

dt.Columns.Add("Countries");

dt.Columns.Add("states");

dt.Rows.Add(new object[]{"NorthCarolina" });

dt.Rows.Add(new object[]{"India " });

dt.Rows.Add(new object[]{"New York " });

dt.Rows.Add(new object[]{"Washington " });

dt.Rows.Add(new object[]{"London"});

dt.Rows.Add(new object[]{"Canada"});

autoComplete1.DataSource=dt;

}

private void button1_Click(object sender, System.EventArgs e)

{

dt.Rows.Add(new object[]{"new1"});

dt.Rows.Add(new object[]{"new2"});

//sets the internal table data based on the AutoComplete.DataSource property.

this.autoComplete1.SetTableData ();

}

VB

Private dt As DataTable

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)

dt = New DataTable("select")

dt.Columns.Add("Countries")

dt.Columns.Add("states")

dt.Rows.Add(New Object() {"NorthCarolina"})

dt.Rows.Add(New Object() {"India "})

dt.Rows.Add(New Object() {"New York "})

dt.Rows.Add(New Object() {"Washington "})

dt.Rows.Add(New Object() {"London"})

dt.Rows.Add(New Object() {"Canada"})

autoComplete1.DataSource = dt

End Sub

Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

dt.Rows.Add(New Object() {"new1"})

dt.Rows.Add(New Object() {"new2"})

Me.autoComplete1.SetTableData

End Sub

Article ID: Published Date: Last Revised Date: Platform: Control:
1482 04/30/2011 07/10/2014 WinForms AutoComplete
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon