dataGridView1实现上一条,下一条,首记录,尾记录按钮

首记录:this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex, 0];

上一记录:if (this.dataGridView1.CurrentCell.RowIndex > 0)
            {
                this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex, this.dataGridView1.CurrentCell.RowIndex - 1];
            }


下一记录:
if (this.dataGridView1.CurrentCell.RowIndex < this.dataGridView1.RowCount - 1)
            {
                this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex, this.dataGridView1.CurrentCell.RowIndex + 1];

            }

末记录:
this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex, this.dataGridView1.RowCount - 1];

posted @ 2012-09-04 16:34  MillerShi  阅读(174)  评论(0编辑  收藏  举报