title: How to keep "schema" of datagridview after DataSource refresh
body: <p>I have 2 DataGridViews, it´s a kind of MasterDetail tables. I have a problem with Detail DataGridView called "dgw". It´s DataSource is datatable, <code>dgw.DataSource=DataTable;</code>. In code I do some work with columns like change names, add some columns, <code>dgw.Columns.Add(NewColumn);</code> change type of column, make some columns not visible etc.</p>
  
  <p>Problem is, that when I set DataSource of dgw again, which is always when the row is changed in Master DataGridView, all my work with columns in dgw is gone and I see "ugly" columns without any changes I made to them.</p>
  
  <p>This is how I refresh DataSource of dgw, code is called on every change of row in MasterDataGridView.</p>
  
  <pre><code>dgw.DataSource = typeof(DataTable);
  dgw.DataSource = GetVCVDataSource(dataTable);
  </code></pre>
  
  <p>I found some solution and I thought that 1st line should do the work but I probably did not get the idea. Before it was <code>dgw.DataSource = null;</code>, I used that to turn off events that happened during datasource assignment.</p>
  
  <p>I believe that there must be some easy solution but I can not work it out.</p>
  
  <p>Thank you for any advice.</p>