Column order changed at run time in DataGridView

The DataGridView has 7 columns with headers ( ID, TITLE, AUTHOR, GENRE, PRICE, PUBLISH, DESCRIPTION ). The order of two columns and the new order ( ID, AUTHOR, TITLE, GENRE, PRICE, PUBLISH, DESCRIPTION ) are changed on the data in a datagridview from an xml file. What is the reason for this?

Reading from an XML file

Application.DataSet dsFileData = new DataSet("Books"); dsFileData.ReadXml(lSoruceFile); dgvBooksDetails.DataSource = dsFileData; dgvBooksDetails.DataMember = "book"; 
+6
source share
1 answer

You need to set the AutoGenerateColumns property to false.

+8
source

Source: https://habr.com/ru/post/920100/


All Articles