سلام من يه گريد ويو دارم كه ميخوام با كليك روي يه دكمه،اول اطلاعاتي كه داخل چنتا تكس باكسه رو به گريدويو اضافه كنه بعد يه سطر به گريد ويو اضافه شه.كد زير رو نوشتم:
privatevoid button1_Click(object sender, EventArgs e)
{
int k = dataGridView1.Rows.Count-1;
dataGridView1.Rows[k].Cells[0].Value = k;
dataGridView1.Rows[k].Cells[1].Value = textBox1.Text;
dataGridView1.Rows[k].Cells[2].Value = textBox2.Text;
dataGridView1.Rows[k].Cells[3].Value = textBox3.Text;
dataGridView1.Rows[k].Cells[4].Value = textBox4.Text;
dataGridView1.Rows[k].Cells[5].Value = textBox5.Text;
dataGridView1.Rows.Add(1);
}
اماوقتي روي دكمه ميزنم خطاي زيرو ميده:Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound.مشكلش چيه؟