Gets or sets the text that is displayed when the column contains a null value.
[Visual Basic] Overridable Public Property NullText As String [C#] public string NullText {virtual get; virtual set;} [C++] public: __property virtual String* get_NullText(); public: __property virtual void set_NullText(String*); [JScript] public function get NullText() : String; public function set NullText(String);
A string displayed in a column containing a null value.
The DataColumn class's AllowNull property determines if a column can contain null values.
Use the EnterNullValue method to enter the value in a DataGridColumn.
The following example tests a DataGridColumn to determine iits column type. If the column is a DataGridTextBox, and the DataColumn allows a null reference (in Visual Basic Nothing) values, then the NullText property is set, and the EnterNullValue method invoked.
[Visual Basic]
Private Sub SetNullText() Dim dgCol As DataGridColumn Set dgCol = DataGrid1.GridColumns(DataGrid1.CurrentCell.ColumnNumber) If dgCol.GetType = "DataGridTextBox" And dgCol.DataColumn.AllowNull Then dgCol.NullText = "Null Text" dgCol.EnterNullValue End If End Sub
DataGridColumn Class | DataGridColumn Members | System.WinForms Namespace | AllowNull