I've created a drag and drop DataGridView in Visual Studio 2013 and then bound it to a dataset using wizard. My problem is when I update the data in the database, the DataGridView
does not get refreshed.
I have used this code : how ever data binding of the same Form's textboxes get refreshed and updated.
dataGridView1.Refresh();
and
dataGridView.Update();
EDIT: this code also doesnt work :
private void toolStripButton4_Click(object sender, EventArgs e)
{
bindingSource1.ResetBindings(true);
}
Following code worked write for me, first you should call the GetChanges() method on your data-set, then call the Fill(dataset.dataTable) on your dta-adapter.
secaloFormulaDataSet.GetChanges();
materialPriceTableAdapter.Fill(secaloFormulaDataSet.materialPrice);
this will immediately updates your datagridview and other controls that use data binding in your form.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.