Hello I try to delete rows with the following code but I get an error. I have tried everything but I can not find out why it will not let me erase the rows of the data gridview.
private void button_BorrarUv_Click(object sender, EventArgs e)
{
if (dataGridViewUvCnf.CurrentRow.Index != -1)
{
dataGridViewUvCnf.Rows.RemoveAt(dataGridViewUvCnf.CurrentRow.Index);
}
}
I get the following error when I run this:
InvalidOperationException: Can not delete rows programmatically unless DataGridView is bound to data with IBindingList that supports change notification and allows deletion.
The Desginer code is as follows
this.button_BorrarUv.Click += new System.EventHandler(this.button_BorrarUv_Click);
Why does this error occur? I have tried to change the EventArgs by DataGridViewCellEventArgs but it does not let me change it I get an error in the designer. I can not know what an IBiningList means. In the properties of the datagridview I have enabled the editing and enable delete rows but it still does not work.
Thanks