安排在一个DataGridView列 [英] Arrange Columns in a DataGridView

查看:84
本文介绍了安排在一个DataGridView列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的datagridview 由一个存储过程填充。通常,我会重新安排使用编辑列对话框,但这 DataGridView中列被用来显示来自不同来源的数据,所以我不能做到这一点。

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 columns Frozen but how do I change the display order on them?

推荐答案

随着的的DisplayIndex 财产

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

这篇关于安排在一个DataGridView列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆