I am using C# + winforms to develop software.
I have a UserControl which contains several DataGridView
datagridview1.datasource = from p in dc.doctor select p;
I use linq to sql to populate the dataGridView with dataSource, because I need to refresh the datasource to update the records, so I create a new dataContext and assign the datasource again.
datagridview1.datasource = from p in dc.doctor select p;
At first I found, although I reset the datasource, the datagridview still can not get refreshed, someone tell me that I should call the invalidate function on datagridview, I tried. To a certain extent, it works.
But If I called the Invalidate inside the UserControl's class, it won't work.
If I create a public function on the UserControl's class, then call it with userControl.refreshRecord(), Then it works.
Can someone point me what am I missed ? When someone call invalidate, when will it really work?
Thanks in advance !