上一条和下一条记录

来源:互联网 发布:南通it 编辑:程序博客网 时间:2024/06/11 12:06

private void button9_Click(object sender, EventArgs e)//下一条记录按钮
        {
            if (dataGridView1.CurrentCell.RowIndex != dataGridView1.RowCount - 1)
            {
                this.dataGridView1.CurrentCell = this.dataGridView1;
            }
            else
            {
                MessageBox.Show("已到达末记录","警告",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
        }

        private void button10_Click(object sender, EventArgs e)//上一条记录按钮
        {
            if (dataGridView1.CurrentCell.RowIndex != 0)
            {
                this.dataGridView1.CurrentCell = this.dataGridView1;
            }
            else
            {
                MessageBox.Show("已到达首记录", "警告", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 

原创粉丝点击