title: Datagridview Ordering of Column Headers- Winform C#
body: <p>I have a datatable bound to a datagridview. However, the ordering of columns is messed up. I already made a column headers for each field put dataproperty name. I arranged it in the designer view. However, if i run the program column headers doesn't follow my arrangement. =_=. Does anybody know how to solve this....</p>
  
  <p>EDIT::
  I've Tried this approach. Is it Okay?</p>
  
  <pre><code>void SortDataGridViewColumns(DataGridView dgv)
  {
      var list = from DataGridViewColumn c in dgv.Columns
                 orderby c.Index
                 select c;
  
      int i = 0;
      foreach (DataGridViewColumn c in list)
      {
          c.DisplayIndex = i++;
      }
  }
  </code></pre>
  
  <p>***I've got this here but I use Index instead of Headertext. CASE CLOSED! LOL</p>