DataGridBoolColumn.NullValue Property

 

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

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[TypeConverterAttribute(typeof(StringConverter))]
public object NullValue { get; set; }

Property Value

Type: System.Object

The value, typed as Object.

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.

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

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;
}


.NET Framework
Available since 1.1
Return to top
Show: