kaharas
kaharas

Reputation: 607

DataGridView reorder columns when filled with data

In a VS2010 program, I have a DataGridView with custom Columns ( not editables ). When I start the GUI, columns are shown in the order I put them; the problem is that when the program starts filling them, columns are reordered in some strange way, and I can't figure out why ( i disable the manual reordering and resizing option). How can I force the columns to stay in the order I've decided?

Upvotes: 1

Views: 2143

Answers (4)

user2499779
user2499779

Reputation: 1

Try to set the Grid Columns DisplayIndex propert in ascending order only i.e. 1,2,3,4 etc. In case if your grid conatins visible and invisible columns, you must set the grid DisplayIndex for the invisible columns as well.

Upvotes: 0

Davide Piras
Davide Piras

Reputation: 44595

if AutoGenerateColumns is set to true put it to false in the properties of your DataGridView. How does it work then?

Upvotes: 3

Check if your DTG is creating collumns automatically.

Upvotes: 0

Related Questions