title: Flickering during updates to Controls in WinForms (e.g. DataGridView)
body: <p>In my application I have a DataGridView control that displays data for the selected object. When I select a different object (in a combobox above), I need to update the grid. Unfortunately different objects have completely different data, even different columns, so I need to clear all the existing data and columns, create new columns and add all the rows. When this is done, the whole control flickers horribly and it takes ages. Is there a generic way to get the control in an update state so it doesn't repaint itself, and then repaint it after I finish all the updates? </p>
  
  <p>It is certainly possible with TreeViews:</p>
  
  <pre><code>myTreeView.BeginUpdate();
  try
  {
      //do the updates
  }
  finally
  {
      myTreeView.EndUpdate();
  }
  </code></pre>
  
  <p>Is there a generic way to do this with other controls, DataGridView in particular?</p>
  
  <p>UPDATE: Sorry, I am not sure I was clear enough. I see the "flickering", because after single edit the control gets repainted on the screen, so you can see the scroll bar shrinking, etc.</p>