用this.dataGridView.Rows.Add()方法只能在dataGridView现有行的末尾增加行,
如果我想在现有行的前面——第一行增加行怎么写?
在指定行前增加行又怎么写?
谢谢!

解决方案 »

  1.   

     this.dataGridView1.Rows.Insert(0, 1);
      

  2.   

    public virtual int AddCopies(int indexSource, int count)
        System.Windows.Forms.DataGridViewRowCollection 的成员摘要:
    基于指定索引处的行在集合中添加指定数目的行。参数:
    indexSource: 新行所基于的行的索引。
    count: 要添加到 System.Windows.Forms.DataGridViewRowCollection 的行数。返回值:
    已添加的最后一行的索引。
      

  3.   

    如果绑定记录集,能不能考虑在数据表中 ds.Tables["Mytable"].Rows.InsertAT.