Winforms datagridview column order

  • Thread starter Thread starter John
  • Start date Start date
J

John

My columns are changing order. When I run my program the columns are in a
different order than they were in design view. Is there any reason why this
should happen?
 
John said:
My columns are changing order. When I run my program the columns are in a
different order than they were in design view. Is there any reason why
this should happen?

This is really confusing. Help, please!

The Barcode column appears after the View column when I run the application
which is not the case in design mode.

I do this in the forms constructor method also :
dataGridView1.Columns["ItemCode"].DisplayIndex = 0;

dataGridView1.Columns["Description"].DisplayIndex = 1;

dataGridView1.Columns["Warehouse"].DisplayIndex = 2;

dataGridView1.Columns["Barcode"].DisplayIndex = 3;

dataGridView1.Columns["View"].DisplayIndex = 4;
 
Back
Top