开发者

Get DataGridView columns in order of user's ordering

开发者 https://www.devze.com 2022-12-09 08:28 出处:网络
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 collec

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 :)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消