[RESOLVED] DataGridViewCheckBoxCell...
Hi all.
How do I get the value of checkboxcell in DataGridView control?
the value,TrueValue,FalseValue always return as null...
in the column I set the TrueValue to "true" and the FalseValue to "false"
this is the first time i'm trying to access this control so I must doing something wrong here.
Re: DataGridViewCheckBoxCell...
You don;t need to set the TrueValue and FalseValue because they will be True and False by default. It's only if you want something other than those defaults, e.g. "Yes" and "No", that you need to set them explicitly. As for getting the value, just like every other cell in a DataGridView, it's the Value property yo want. If you aren't getting the correct data then you must be doing it wrong. As you haven't shown us what you're doing, we can't say what that might be.
Re: DataGridViewCheckBoxCell...
the Value Property of the cell is always null, I try to get the value from the CellClick event..
now that I think about it, do I get the value of the cell and not of the CheckBox Control?
is there click event for the DataGridViewCheckbox control? I will check it now.
Re: DataGridViewCheckBoxCell...
Ok, got it working.
Thanks.
Re: [RESOLVED] DataGridViewCheckBoxCell...
There is no CheckBox control. The cell simply contains a rendering of a check box.
What do I always say? Read the documentation.
Quote:
If you want to respond immediately when users click a check box cell, you can handle the DataGridView.CellClick event, but this event occurs before the cell value is updated.
Re: [RESOLVED] DataGridViewCheckBoxCell...
Yes John I agree and trust me I'm doing a lot of reading, but sometimes you just needs to get the job done as fast as you can and move on. (and this is exactly one of those time ehe)
The problem was that I didn't set the DataGridViewCheckBoxCell default value when I initialize it.