How add column to datagrid view between particular columns?
here i means ,my colum name is Class, i have a datagrid view with column names that
StudName StudID StudAdd
i want to add my column class add between StudID and StudAdd
my expected output is
StudName StudID Class StudAdd
Add column to datagrid view
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Vishal GilbileRank #268 · 9.4K reputationPosted Jun 11, 2011, 3:59 AM EDT
hi you can make use of the following code.
this
.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {this.StudentId,this.Class,this.StudentName});VulpesRank #55 · 29.2K reputationPosted Jun 11, 2011, 4:42 AM EDT
So, to insert a column immediately after it, you'll need a line such as this:
dataGridView1.Columns.Insert(2, ClassColumn);
where ClassColumn is your DataGridViewColumn object.
I'm not absolutely sure but I think you'll also have to set the DisplayIndex for this column to 2 as well, otherwise it will be displayed after the other columns by default.