怎样用代码控制DataGridView的记录移?
比如:向上
pc_hdDataGridView.Rows[pc_hdDataGridView.CurrentRow.Index>0?pc_hdDataGridView.CurrentRow.Index - 1:0].Selected = true;
pc_hdDataGridView.CurrentCell = pc_hdDataGridView.Rows[pc_hdDataGridView.CurrentRow.Index>0?pc_hdDataGridView.CurrentRow.Index - 1:0].Cells[0];
向下:
pc_hdDataGridView.Rows[pc_hdDataGridView.CurrentRow.Index < pc_hdDataGridView.Rows.Count -1? pc_hdDataGridView.CurrentRow.Index + 1 : pc_hdDataGridView.CurrentRow.Index].Selected = true;
pc_hdDataGridView.CurrentCell = pc_hdDataGridView.Rows[pc_hdDataGridView.CurrentRow.Index < pc_hdDataGridView.Rows.Count-1 ? pc_hdDataGridView.CurrentRow.Index + 1 : pc_hdDataGridView.CurrentRow.Index ].Cells[0];
写作于:
2007-08-08 22:05
本文提供了一种使用C#代码控制DataGridView中当前选中行上下移动的方法。通过简单的条件判断,可以实现向上或向下选择行的功能。
2240

被折叠的 条评论
为什么被折叠?



