Responding to an old post/question, i tried turning off the
AutoGenerateColumns
property of the datagridview before assigning the displayindex.
dgv1.AutoGenerateColumns = false;
dgv1.Columns["column1HeaderText"].DisplayIndex = 0;
dgv1.Columns["column2HeaderText"].DisplayIndex = 1;
dgv1.Columns["column3HeaderText"].DisplayIndex = 2;
One suggestion is that if there are some columns/any column that has to be hidden then hide it after setting the display index.
dgv1.Columns["column1HeaderText"].Visible = false;
Hope this helps someone!