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("最后一条记录");
                }
            }

  • 相关阅读:
    kafka 配置属性
    mybatis 启动流程源码分析(二)之 Configuration-Properties解析
    mybatis 配置文件
    mybatis 启动流程源码分析(一)
    mybatis configuration
    使用函数式编程替换if-else
    mybatis 基本使用
    第十二周学习笔记
    T-SQL的进阶:超越基本级别3:构建相关子查询——701小组
    第十周学习笔记
  • 原文地址:https://www.cnblogs.com/tianguook/p/2540660.html
Copyright © 2011-2022 走看看