你放一个DataGridView在你的窗体上,就能知道是怎么添加的了。

解决方案 »

  1.   

    DataGridView 更新
    forach(DataRow dr in dt.Rows)
    {
    DataGridViewRow row = new DataGridViewRow();   
    row.Cells[0].Value =dt[""].ToString();  
    row.Cells[1].Value = dt[""].ToString();  
    this.dataGridView1.Rows.Add(row);
    }

    DataGridViewRow dr = dataGridView1.Rows[dataGridView1.NewRowIndex];  
    dataGridView1.Rows.Add(dr);  
      

  2.   

    其实往DGV中插入数据的话还是在其他控件中进行赋值然后往数据库中插然后在从数据库读到DGV上的!也许还有其他直接插入的方法但是我影像中就是这样的!还请高手指教!
      

  3.   

    如果AllowUserToDeleteRows属性为true,点击末尾就能添加新行。
    如果为false,可以通过代码加入,可以直接在DataGridView中加,也可以在数据源中加。