NullText Property

DataGridColumnStyle.NullText Property


Gets or sets the text that is displayed when the column contains null.

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

public virtual string NullText { get; set; }

Property Value

Type: System.String

A string displayed in a column containing a DBNull.Value.

The DataColumn class's AllowDBNull property determines if a column can contain null values.

The following code example sets the NullText property to a new string.

private void SetNullText()
    DataGridColumnStyle myGridColumn;
    myGridColumn = dataGrid1.TableStyles[0].GridColumnStyles[0];
    myGridColumn.NullText = "Null Text";

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft