In Windows Forms (.NET 2.0, Visual Studio 2005 SP1) : I have a typed DataSet
, with a column which type is System.Boolean
, which is nullable and whi
The easist way I know, is derive from CheckBox class, add "DataValue" property which can handle DBNull values and bind the data to "DataValue" property:
public class DataCheckBox : CheckBox {
public virtual object DataValue {
get { return this.Checked; }
set {
if ( value == null || value is DBNull ) {
this.CheckState = CheckState.Indeterminate;
}
else {
this.Checked = (bool)value;
}
}
}
}