I try to delete row from Grid using the follwing code :
Int32 index = Grid.ActiveRow.Index; Grid.ActiveRow.Delete(false);
But This error comming :
---------------------------Data Error---------------------------Unable to delete the row:
Collection was of a fixed size.---------------------------OK ---------------------------
Some collections are read only like array and ReadOnlyCollection. If this is your case, than your data source should have IsFixedSize = true. Debug and see if it is true, or try to delete the row like any user (select the row and press "delete").
I am using Array of ojects to fill dataSource of BindingSource control and then bind the grid like this :
bindingSource.DataSource = GetInfo(); //this return array of objects like : Student[
Grid.DataSource = GridbindingSource;
and I try to search inside grid and BindingSource controls to find somthing like IsFixedSize but i didn't find .
Thank You .I change it to List<T>,and it's working now.
With BindingSource you can check the AllowRemove property. You can't delete from an array. Use any other collection like List<T>.