DataGridView not updating after DataTable applied sorted until a few mouse clicks are dropped

  • Thread starter Thread starter AlanChong
  • Start date Start date
A

AlanChong

Guest
Hello all. It's time consuming dealing with this problem. No solutions. I have a DataGridView bound to a BindingSource and a DataTable (table). Col1 holds serial numbers 1,2,3.. etc. I changed row order by altering the values of Col1 through table.DefaultView. It worked well with table and the order was correct. But DataGridView didn't reflect the new order I tried to force DataGridView1 to refresh by calling the following but nothing worked:

bindingSource1.ResetBindings(false);

DataGridView1.DataSource = null;

DataGridView1.DataSource = bindingSource;

DataGridView1.Refresh();

DataGridView1.Focus();

this.Update();

Then I used the mouse to click different places in DataGridView1. DataGridView1 suddenly got refreshed and the order is correct.

So, who was behind the scene and got lazy not doing the updating job ?

How can make sure DataGridView1 refresh everytime. I cannot ask the users to do these clicks every time they finish ordering.

Thanks

Continue reading...
 
Back
Top