Column order issue in dataGridViews in C #

I populate the dataGrid by binding the dataSet to the grid using aDataGridView.dataSource = aDataSet.aTableName, when I trace the code after using this function, all the reset column indices are 0, what can I do? How can I find new real indexes? can i use another function?

I tried this code, which I found here, but it does not work: this.dataGridView1.DataSource = null; this.dataGridView1.Columns.Clear (); this.dataGridView1.DataSource = data;

+3
source share
2 answers

Set dataGridView1.AutoGenerateColumns = false; before assigning a DataSource.

+6
source

, ? , DataSource DataGridView - DataTable DataGridView, . , , , ...

+1

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


All Articles