By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,079 Members | 1,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,079 IT Pros & Developers. It's quick & easy.

DataGridView CheckBox Cell

P: n/a
Using VS 2005.

I have an app that has a DataGridView control. This control has two
columns, the first column is a standard TextBox, and the second column
is a CheckBox.

I am having difficulty determining the state of the CheckBox, whether
it is checked or not. I have identified an event that fires when the
user clicks in the checkbox, CellClick. In that event handler I
declare a local variable of the DataGridViewCheckBoxCell type and set
it to the cell that fired the event with a statement like this:

DataGridViewCheckBoxCell chk;

if (e.ColumnIndex == 1)
chk = datagridview.Rows[e.RowIndex].Cells[e.ColumnIndex];

But the chk.Value property is ALWAYS set whether the checkbox is
checked or not!!!

I have searched the help files but cannot find anything on how to
handle ANY of the DataGridView special cell types. How do I determine
the state of this checkbox cell?

TIA,

Nov 12 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
za***@construction-imaging.com wrote:
Using VS 2005.

I have an app that has a DataGridView control. This control has two
columns, the first column is a standard TextBox, and the second column
is a CheckBox.

I am having difficulty determining the state of the CheckBox, whether
it is checked or not. I have identified an event that fires when the
user clicks in the checkbox, CellClick. In that event handler I
declare a local variable of the DataGridViewCheckBoxCell type and set
it to the cell that fired the event with a statement like this:
[...]

According to the docs
(http://msdn2.microsoft.com/en-us/lib...ckboxcell.aspx)
the value will be either True or False when in simple on/off (binary) mode.

Chris.
Nov 12 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.