I have a datagridview with a column with checkbox in it. What I am trying to do is when user click on the check box, I need to check for some other conditions, and only allow the check box to be selected if conditions meet other wise stop the event and dont allow checkbox selection.
Can some one guide pls?
OK, so here is the recap of my problem
I have a windows form application, it loads some information from a datasource(file, db etc).
When its loaded, every row’s first column has DataGridViewCheckBoxCell in it. Requirement was that when a user clicks on the checkbox, it must be checked against the source that this particular row was not checked by any other user from any other workstation.
My Solution Logic as I envisioned it:
I wanted to make sure when user clicks on the cell, before chackbox is checked, I check from the data source and don’t allow checkbox to be selected or allow it based upon if this row was used by some one else or not.
My Solution:
What I came up with is to use CellClick event, because when user clicks on the cell, the checkbox is yet to be selected, then I check the datasource if any other user is using it or not, if it is being used, I set the
checkbox.ReadOnly=true
This way this event essentially is dead and nothing happens…:-)
I wish I had a better approach but this is working for my needs.
Thanks for every one who tried to help.