zoukankan      html  css  js  c++  java
  • datagridview 上一条数据,下一条数据实现

    private void button2_Click(object sender, EventArgs e)
            {
                if (dataGridView1.CurrentCell.RowIndex !=0)
                {
                    dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
                    this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex, this.dataGridView1.CurrentCell.RowIndex - 1];
                    textBox1.Text = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString();
                }
                else
                {
                    MessageBox.Show("第一条数据");
                }
            }

            private void button3_Click(object sender, EventArgs e)
            {
                if (dataGridView1.CurrentCell.RowIndex != dataGridView1.RowCount - 1)
                {
                    dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
                    this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex, this.dataGridView1.CurrentCell.RowIndex + 1];
                    textBox1.Text = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString();
                }
                else
                {
                    MessageBox.Show("最后一条记录");
                }
            }

  • 相关阅读:
    js字符串分割
    Maven打包出错Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test
    Kafka
    linux 切换PHP版本
    linux 查看服务状态及开发端口
    php消息队列
    windows 设置composer 淘宝镜像
    PHP使用CURL详解
    linux php7.0 安装redis扩展
    linux 快速查找安装目录方法
  • 原文地址:https://www.cnblogs.com/tianguook/p/2540660.html
Copyright © 2011-2022 走看看