views:

79

answers:

1

I have an app that lets the user reorder columns in a DataGridView, and I want to save the "layout" upon closing the app...but it seems that when I iterate through the column collection, I get them in the order I added them, not the order they appear on screen. Is there a way to get the displayed ordering?

edit: found it, just check the DisplayIndex property of each column :)

+3  A: 

You'll have to use the DataGridViewColumn.DisplayIndex property. http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.displayindex.aspx

popester