怎样用代码控制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