how to insert value into DataGridView Cell?

前端 未结 5 1787
失恋的感觉
失恋的感觉 2021-02-05 14:24

I have DataGridView (that hold any DataBase)

I want to insert any value into any Cell (and that this value will save on DataBase)

How t

5条回答
  •  梦谈多话
    2021-02-05 14:42

    This is perfect code but it cannot add a new row:

    dataGridView1.Rows[rowIndex].Cells[columnIndex].Value = value;
    

    But this code can insert a new row:

    var index = this.dataGridView1.Rows.Add();
    this.dataGridView1.Rows[index].Cells[1].Value = "1";
    this.dataGridView1.Rows[index].Cells[2].Value = "Baqar";
    

提交回复
热议问题