This is my code for my UserDynamicSetsControl
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.ColumnsA,this.ColumnB,this.ColumnsC,this.ColumnD});
And the second solution (I use it interchangeably)
var list= new System.Windows.Forms.DataGridViewColumn[] { this.ColumnsA,this.ColumnB,this.ColumnsC,this.ColumnD};
foreach (DataGridViewColumn dataGridViewColumn in list)
{
dataGridView1.Columns.Add(dataGridViewColumn);
}
Those codes works, but add columns in wrong order , e.g. columnB,columnC,columnA,columnD.
How to make sure that those column are in good order?
Have you checked the DisplayIndexs on the columns that you are adding? Ensure that ColumnA has a DisplayIndex of 0, and Column B an 1 etc.
Link to the MSDN regarding DisplayIndex
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.displayindex.aspx
Not 100% sure though, Im used to working with the xceed datagrid not the micorsoft one.