c# When the control is data-bound, it is not possible to programmatically add rows to the row collection of the DataGridView.

This kind of error occurs when
this.dataGridView1.DataSource = this.Dtb_Data;
you have bound the data source to the datagirdview but you want to add data through dataRow. What should I do in this case?
You can assign the datarow you have assigned to the datagirdview by a series of sentences
((DataTable)dataGridView1.DataSource).Rows.Add(dataRow);

Guess you like

Origin blog.csdn.net/hello_mr_anan/article/details/82113385