I have a DataGridView in which I populate it with data from a mysql table and then need to add rows with data from some textbox, when I try to return the following error: "Can not add rows programmatically to the DataGridView row collection when control is associated with data ".
My code:
private void button1_Click(object sender, EventArgs e)
{
Hide();
FormPai.dataGridView1.Rows.Add(txtCod.Text, servicosBox.Text, txtPreco.Text);
FormPai.dataGridView1.Refresh();
}