System.Windows.Forms.DataGridViewCellStyle.NullValue Property

Gets or sets the System.Windows.Forms.DataGridView cell display value corresponding to a cell value of DBNull.Value or null.

Syntax

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

Value

Documentation for this section has not yet been entered.

Remarks

When a System.Windows.Forms.DataGridView cell with this cell style has a value of DBNull.Value or null or the user edits the cell and presses CTRL+0, the System.Windows.Forms.DataGridView control displays the DataGridViewCellStyle.NullValue property value. When a user edits a cell with this cell style and enters the value of this property or presses CTRL+0, the control sets the cell value to the value of the DataGridViewCellStyle.DataSourceNullValue property or to null if DataGridViewCellStyle.DataSourceNullValue is DBNull.Value and the cell DataGridViewCell.ValueType is a reference type. This conversion does not occur when you set the DataGridViewCell.Value property programmatically.

Note:

The control does not display the DataGridViewCellStyle.NullValue property value for cell values equal to the DataGridViewCellStyle.DataSourceNullValue property value when DataGridViewCellStyle.DataSourceNullValue is set to a value other than DBNull.Value or null. In this case, you can handle the DataGridView.CellFormatting event to display the DataGridViewCellStyle.NullValue property value. For more information, see the code example in this topic.

This property takes any object, which enables you to specify a value with a type appropriate to the display type of the cell. For example, you can set this property to string values for use by text box cells or images for use by image cells.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0