开发者

Arrange Columns in a DataGridView

开发者 https://www.devze.com 2023-02-14 21:12 出处:网络
I have a datagridview that is populated by a stored proc.Typically I would reorder the columns using the \'Edit Columns\' dialog but this datagridview is being used to display data from different sour

I have a datagridview that is populated by a stored proc. Typically I would reorder the columns using the 'Edit Columns' dialog but this datagridview is being used to display data from different sources so I can't do that.

I have figured out how to rename the Headers and make certain col开发者_运维百科umns Frozen but how do I change the display order on them?


With the DisplayIndex property

myGridView.Columns["myFirstCol"].DisplayIndex = 0;
myGridView.Columns["mySecondCol"].DisplayIndex = 1;


Can you set the DisplayIndex for the columns?


 grid.AllowUserToOrderColumns = true;
0

精彩评论

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