WinFrom中datagridview如何把任意一行设为当前行(CurrentRow).
设置行的Selected属性为true能选中行,但是,不是当前行(CurrentRow).
如何动态的把gridview中的一行设为当前行(即行头上的哪个小三角指向这一行)?

解决方案 »

  1.   

    int index = 5;//指定一个行号
               
    this.dataGridView1.Rows[index].Selected = true;
                
    this.dataGridView1.CurrentCell = this.dataGridView1.Rows[index].Cells[0];
      

  2.   

    dataGridView控件偶不太喜欢,一个CurrenRow属性,偏偏要设置成只读的,何必呢~~
      

  3.   

    lz为人不地道,解决了不说出来,害我又试了半天,为了后学上进,
    我来说一下:
          Me.dgv.Rows(0).Cells("出库单号").Selected = True
          Me.dgv.Focus()