Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Columns Order Changed at Runtime in DataGridView

DataGridView has 7 columns with headers (ID, TITLE, AUTHOR, GENRE, PRICE, PUBLISH, DESCRIPTION). On data in datagridview from xml file, two columns order is changed and new order is (ID, AUTHOR,TITLE, GENRE, PRICE, PUBLISH, DESCRIPTION). What is reason behind this ?

Reading from the xml file

Application.DataSet dsFileData = new DataSet("Books"); 
dsFileData.ReadXml(lSoruceFile); 
dgvBooksDetails.DataSource = dsFileData; 
dgvBooksDetails.DataMember = "book";
like image 698
Itz.Irshad Avatar asked Jul 10 '12 05:07

Itz.Irshad


1 Answers

You need to set AutoGenerateColumns property to false.

like image 105
Vale Avatar answered Oct 19 '22 23:10

Vale