Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I edit the values in my DataGridView, even though its not set to ReadOnly?

I have a DataGridView, which is not set to ReadOnly. None of its columns are set to ReadOnly, and the object it is bound to is not set to ReadOnly. Yet, I can't edit the DataGridView items? The .DataSource property of the DataGridView is set to a ReadOnlyCollection<>, but I can programmatically alter the elements, just not from the UI. What's going on?

like image 326
GWLlosa Avatar asked May 27 '09 12:05

GWLlosa


1 Answers

It turns out that if your DataGridView is bound to a ReadOnlyCollection, then even though you can programatically edit any item in the collection, the DataGridView will restrict you from changing the values. I'm not sure if this behavior is intentional, but its something to watch out for.

like image 183
GWLlosa Avatar answered Oct 14 '22 10:10

GWLlosa