下面这4个代码的注释 谢谢
          this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[0];
            if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count - 1)
            {
                MessageBox.Show("已到尾记录!");
                return;
            }
            this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex + 1].Cells[0];
            f (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count)
            {
                MessageBox.Show("已到首记录!");
                return;
            }
            this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex - 1].Cells[0];            this.dataGridView1.CurrentCell = this.dataGridView1.Rows[0].Cells[0];

解决方案 »

  1.   

    CurrentCell :当前单元格  。剩下的你应该知道吧。
      

  2.   

    //当前单元格         
     this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[0]; //如果当前行号=行数-1  也就是倒数第二行
                if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count - 1) 
                { 
                    MessageBox.Show("已到尾记录!"); 
                    return; 
                } 
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex + 1].Cells[0]; 
                f (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count) 
                { 
                    MessageBox.Show("已到首记录!"); 
                    return; 
                } 
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex - 1].Cells[0]; 
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[0].Cells[0];
      

  3.   

    //dataGridView1的当前单元格的数据等于最后一行的第0列单元格的值
    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[0];//判断dataGridView1的当前单元格的行号(索引号)是否等于最后的行号
    if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count - 1) //dataGridView1的当前单元格的数据等于这个单元格行号+1且第0列单元格的值
    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex + 1].Cells[0]; 后面差不多!!
      

  4.   


    //当前单元格的焦点=倒数第二行的第一单元格
              this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[0];//如果当前单元格的索引==所有行-1的话
                if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count - 1)
                {
                    MessageBox.Show("已到尾记录!");
                    return;
                }
    //当前单元格的焦点=当前单元格的索引+1
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex + 1].Cells[0];//如果当前单元格的索引==所有行的话
                f (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count)
                {
                    MessageBox.Show("已到首记录!");
                    return;
                }
    //当前单元格的焦点=当前单元格的索引-1
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex - 1].Cells[0];//当前单元格的焦点=倒数第1行的第一单元格
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[0].Cells[0];
      

  5.   

    //dataGridView1当前单元格的焦点 指向 倒数第一行的第一个单元格
              this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[0];//如果当前单元格的索引已经是最后一行的第一个单元格的话,即已到最后行了,给出提示
                if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count - 1)
                {
                    MessageBox.Show("已到尾记录!");
                    return;
                } 
      

  6.   


    //设置dataGridView1的最后一行的第一个单元格处于激活状态
    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[0]; 
    //如果dataGridView1的处于激活状态的单元格的行索引等于dataGridView1的最后一行的索引
    if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count - 1) 

        MessageBox.Show("已到尾记录!"); 
        return; 

    //获取dataGridView1的最后一行的处于激活状态的第一个单元格
    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex + 1].Cells[0];//如果dataGridView1的处于激活状态的单元格的行索引等于dataGridView1的最后一行的索引
    //这个判断好像永远不成立因为RowIndex不会等于RowCount
    if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count) 

        MessageBox.Show("已到首记录!"); 
        return;
    }
    //设置dataGridView1的当前行的第一个单元格处于激活状态
    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex - 1].Cells[0];//设置dataGridView1的第一行的第一个单元格处于激活状态
    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[0].Cells[0];
      

  7.   

    //当前正在活动的单元格是最后一行的第一个单元格
              this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[0];//如果当前单元格的索引等于最后一行的索引的情况下弹出一到末尾的提示框下面不再执行
                if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count - 1)
                {
                    MessageBox.Show("已到尾记录!");
                    return;//停止执行下面代码
                }
    //使下一行的第一个单元格获取焦点
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex + 1].Cells[0];//如果当前单元格的行索引等于表的记录行数弹出到首记录停止下面代码
                f (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count)
                {
                    MessageBox.Show("已到首记录!");
                    return;//通上
                }
    //当前焦点跳到上一行第一格
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex - 1].Cells[0];//跳到第一行第一格
                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[0].Cells[0];上面的有个人的注释有误