PC Review


Reply
Thread Tools Rate Thread

DataGridView CheckBox Cell

 
 
zacks@construction-imaging.com
Guest
Posts: n/a
 
      12th Nov 2007
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,

 
Reply With Quote
 
 
 
 
Chris Shepherd
Guest
Posts: n/a
 
      12th Nov 2007
(E-Mail Removed) 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.
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGridView checkbox. Mr. X. Microsoft VB .NET 4 25th Jun 2010 08:01 AM
DataGridView Checkbox Carolina Microsoft Dot NET Framework Forms 3 17th Sep 2007 08:14 PM
DataGridView Problem with unbound Checkbox cell Martin Microsoft VB .NET 1 3rd Dec 2006 06:35 PM
Get value of a checkbox in a datagridview =?Utf-8?B?RGF2ZQ==?= Microsoft C# .NET 0 16th Oct 2006 10:00 PM
Howto: DataGridView VB.NET 2005 - How can I set cell type to checkbox programmatically? Sam Malone Microsoft Dot NET Framework Forms 1 30th Jul 2006 11:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:45 AM.