خطای Rows cannot be programmatically added ... when the control is data-bound
سلام دوستان وقتی میخام اطلاعات درون یک تکست باکس رو با کد زیر وارد دیتاگیرید ویو کنم:
DataGridViewRow row = new DataGridViewRow();
// create cells
row.CreateCells(this.dataGridView1, roz.Text);
// add to data grid view
this.dataGridView1.Rows.Add(row);
با پیغام زیر مواجه میشم:
Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound
نقل قول: پیغام خطا هنگام ثبت اطلاعات در دیتا گیرید ویو
DataRow row = dt.NewRow();
row["columnname"]= tbName.Text.toString();
dt.Rows.Add(row);
dt.AcceptChanges();
dataGridView1.DataSource= dt;
dataGridView1.DataBind();