I’ve a datagridview. I read an xml file and bind the data to the gridview. I change the xml and save it in another form. So i reread the xml file and i bind it to the gridview. The datatable is getting the updated values. But the grid is not getting updated till i close and open the application again. How to do it?
Thank you.
Regards,
Raghavendra
#1
Is there a Databind() or Rebind() for DataGridView? I set the datasource like this –
dvMoviesList.DataSource = dtMovies;
If i add any new row to the dtMovies table and set the datasource again, it is getting reflected. But if i edit the values of any of the existing rows and re assign the datasource it is not getting reflected till i close and open the application again. Any ideas?
Thank you.
I think you need to place a BindingSource in between the DataGridView and DataTable.
Now whenever
_dtgets updated, the BindingSource should take care of refreshing the DataGridView and you shouldn’t have to worry about resetting any DataSource property. The DataSource properties can be set in theInitializeComponent()method (the designer), the Form’s constructor, or Form.Load event handler.