I am trying to get my grid to refresh automatically when the underlying data is updated in the database. Isn’t this supposed to work? Or am I missing something?
I created a DataTable within my DataSet. Then I created a new form and added a DataGridView (actually I’m using DevExpress’ XtraGrid but am trying to get it to work with just the Microsoft controls). I use the menu in the upper left of the grid to set the grid datasource to the datatable in the project data source. This then automatically adds the dataset, BindingSource, and TableAdapter to the form.
Then when I add a BindingSource.ListChanged event it fires a few times when the form loads but not when any underlying data is changed.
Should the even fire when the data in the database changes? Or is it only if the data is changed from somewhere else in the current VB.NET process?
Thanks for your help!
The listchanged event will only fire when the bound object changes, not when the data changes in the db.
If you are retrieving data from the db using sqlclient you can implement SQL dependency http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldependency.aspx