DataGridView行重新定位 [英] DataGridView row repositioning
本文介绍了DataGridView行重新定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种简单的方法可以在未绑定的
DataGridView中交换两行的位置?我正在使用它来显示有序列表,在这里我希望
的向上/向下箭头键可以在网格中上下移动,但是我看不到
可以在其中重新定位行网格而没有完全填充
,这似乎过多。行的索引值是只读的。
Is there a simple way to swap the position of two rows in an unbound DataGridView? I am using it to display an ordered list, where I want the up/down arrow keys to shuffle a row up and down the grid, but I can't see any way to reposition a row within the grid without completely repopulating it, which seems excessive. The Index value for a row is read-only.
推荐答案
要移动行,请使用
DataGridView.Rows。 RemoveAt
,然后
DataGridView.Rows.Insert
to move a row, use DataGridView.Rows.RemoveAt and then DataGridView.Rows.Insert
这篇关于DataGridView行重新定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文