How to programmatically add a row to a datagridview when it is data-bound?

后端 未结 4 619
别跟我提以往
别跟我提以往 2020-12-20 15:56

How can I add a row to a datagridview control if it is bounded to a datasource (datatable) ? Thanks!

4条回答
  •  别那么骄傲
    2020-12-20 16:56

    I used dataset to add row to the datagridview if I try to add rows to the datagridview itself it says that it does not excepts adding rows programaticly because its databound.

    // DataSet of the datagridview can be found in the Form Load

    advokathusetDataSet.Kunde.Rows.Add(DeletedRowsList[lastindex].Cells[0].Value, DeletedRowsList[lastindex].Cells[1].Value, DeletedRowsList[lastindex].Cells[2].Value, DeletedRowsList[lastindex].Cells[3].Value, DeletedRowsList[lastindex].Cells[4].Value, DeletedRowsList[lastindex].Cells[5].Value, DeletedRowsList[lastindex].Cells[6].Value);
    

    // Add row from Datagridview to list and Add row to datagridview from list - How to add row to datagridview using list

提交回复
热议问题