DataGridBoolColumn.NullValue Property

Definition

Gets or sets the actual value used when setting the value of the column to Value.

C#
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.StringConverter))]
public object NullValue { get; set; }

Property Value

The value, typed as Object.

Attributes

Examples

The following code example sets the TrueValue, FalseValue, and NullValue properties of a DataGridBoolColumn.

C#
private void SetBoolColumnValues(){
   DataGridBoolColumn myGridColumn;
   // Get the DataGridBoolColumn you are setting.
   myGridColumn = (DataGridBoolColumn) myDataGrid.
   TableStyles["Customers"].GridColumnStyles["Current"];
   // Set TrueValue, FalseValue, and NullValue.
   myGridColumn.TrueValue = true;
   myGridColumn.FalseValue = false;
   myGridColumn.NullValue = Convert.DBNull;
}

Remarks

You can also specify what text will be displayed by setting the NullText property.

The AllowNull property must be set to true to enter null values.

The FalseValue, NullValue, and TrueValue properties determine the actual values pushed into the data source.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 10

See also