[dba-VB] CheckBox: Checked and CheckState

Gustav Brock Gustav at cactus.dk
Tue May 13 07:48:22 CDT 2008

Hi Charlotte and Doris

I've found that if you bind a DataTable to a non-tristate CheckBox and try to insert a new row having set Checked to either True or False but without specifying the CheckState property, the insert will fail because CheckState will pass a DBNull to the DataTable.

Thus, you must bind the CheckState property to the DataTable and - for a new record - set CheckState to either Checked or Unchecked.


>>> cfoust at infostatsystems.com 09-05-2008 17:45 >>>
We use the CheckStateChanged event and test the Checked value of the
checkbox to determine interaction with other controls.  No focus
shifting required.

Charlotte Foust

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com 
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Friday, May 09, 2008 3:36 AM
To: dba-vb at databaseadvisors.com 
Subject: Re: [dba-VB] CheckBox: Checked and CheckState

Hi all

Maybe the answer is here. At least this is comprehendible and not rocket science:


The ThreeState property determines whether the control supports two or
three states. 

Use the Checked property to get or set the value of a two-state CheckBox
control and use the CheckState property to get or set the value of a
three-state CheckBox control.

If the ThreeState property is set to true, the Checked property will
return true for either a checked or indeterminate state.

Any comments?


>>> Gustav at cactus.dk 08-05-2008 18:29 >>>
Hi all

What is the difference between these two events for a bound CheckBox?

Whatever I try, first event CheckedChanged is fired, then
CheckStateChanged - no matter if I browse the source it is bound to or
if I click or keypress the CheckBox itself (has focus).


More information about the dba-VB mailing list