Magikarp
Magikarp

Reputation: 500

datagridview databinding becomes read only

When I create a DATAGRIDVIEW and bind it with a BindingList, howcome it allow me to edit/change the input on the datagridview? I took a test and it says that the datagridview column is readonly, but when I change values internally it gets updated. I just cant change/edit through the Datagridview. Help?

Nevermind. Solved it. Just created a Datatable to bind it instead.

Upvotes: 0

Views: 423

Answers (1)

tmesser
tmesser

Reputation: 7656

Your question is a little vague, but the semantics of DataGridView.ReadOnly is that it only prevents editing from the interface side. As in, when you are viewing the DataGridView on your form or whatever, you will not be able to interact with the grid. You can still change the data by changing the structure that the DataGridView is bound to in code.

To put it another way, it doesn't matter if the form is read-only; if what's fueling the form changes, the form is going to show that! Setting it as read-only simply stops the user from changing what's fueling the form.

Upvotes: 1

Related Questions