title: c# petapoco object to datagridview, change column order
body: <p>I have a bussiness object like this:</p>
  
  <pre><code>[PetaPoco.TableName("cars")]
  [PetaPoco.PrimaryKey("id")]
  public class Cars : CarObject
  {
      [DefaultValue(null)]
      [DisplayName("Column Name")]
      public string Color { get; set; }
  
      [DefaultValue(null)]
      public string Engine { get; set; }
  
      [DefaultValue(null)]
      public string BHP { get; set; }
  
      [DefaultValue(null)]
      public string Year { get; set; }
  
  }
  </code></pre>
  
  <p>And I display in DataGridView like this:</p>
  
  <pre><code>List&lt;Cars&gt; ret = db.Query&lt;Cars&gt;("select * from cars").ToList();
  if(ret != null)
      dgv.DataSource = ret; // .OrderBy(o =&gt; o.Year).ToList(); 
  </code></pre>
  
  <p>However, seems that DGV put columns like in object (design time) order. I could alter this by using a loop with DGV DisplayIndex property but there is a simple solution, some attribute decorate?</p>
  
  <p>Thanks in advance,</p>
  
  <p>PS. I tried also using System.ComponentModel.DataAnnotations but seems that for WinForms isn't working. The DGV isn't able to bind that attributes.</p>
  
  <pre><code>[Display(Name = "Custom Name", Order = 2)]
  </code></pre>
  
  <p>Any hack? Thanks very much.</p>