Back to Devexpress

RepositoryItem.NullText Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitem-333675a0.md

latest6.7 KB
Original Source

RepositoryItem.NullText Property

Gets or sets the text that presents the editor’s null value ( null , System.DBNull.Value and RepositoryItemDateEdit.NullDate - for DateEdit).

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Behavior")]
public virtual string NullText { get; set; }
vb
<DXCategory("Behavior")>
Public Overridable Property NullText As String

Property Value

TypeDescription
String

The string displayed in the edit box when the edit value equals null , System.DBNull.Value or RepositoryItemDateEdit.NullDate (for DateEdit controls).

|

Remarks

Use the NullText property to present the editor’s null value with custom text.

Use the RepositoryItemTextEdit.NullValuePrompt property to display a hint in an editor when its value is not set.

See the RepositoryItemTextEdit.NullValuePrompt topic to learn more about the difference between these properties.

The NullText property is set to an empty string by default. Thus, to hide the default message, you can set this property to a string of spaces (blank string).

NullText is not supported for a CheckedComboBoxEdit control. This control’s value cannot be set to null.

For lookup editors (LookUpEditBase descendants), the NullText property’s default value is obtained from localization resources (the localization string ID is “StringId.LookUpEditValueIsNull”). The property’s default value is “[EditValue is null]” in the English culture.

The following code snippets (auto-collected from DevExpress Examples) contain references to the NullText property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-data-lookups-combobox-mode/CS/Lookup-ComboboxMode/Form1.cs#L26

csharp
lookUpEdit1.EditValueChanged += LookUpEdit1_EditValueChanged; ;
lookUpEdit1.Properties.NullText = "(select or type value)";

winforms-grid-bind-to-business-objects/CS/GridBoundToRuntimeCreatedData/Form1.cs#L34

csharp
// Specify a different null value text presentation for the Image column
gridView1.Columns["Image"].RealColumnEdit.NullText = "[load image]";

winforms-scheduler-sync-google-event-colors-with-labels/CS/SchedulerGSync/SchedulerGSync/SyncOptionsForm.cs#L17

csharp
this.lookUpEdit1.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False;
this.lookUpEdit1.Properties.NullText = String.Empty;
this.lookUpEdit1.Properties.ShowHeader = false;

winforms-grid-display-icons-in-data-cells/VB/Form1.vb#L177

vb
pictureEdit.SizeMode = PictureSizeMode.Zoom
pictureEdit.NullText = " "
gridView1.Columns("PictureEdit").ColumnEdit = pictureEdit

winforms-data-lookups-combobox-mode/VB/Lookup-ComboboxMode/Form1.vb#L24

vb
AddHandler lookUpEdit1.EditValueChanged, AddressOf LookUpEdit1_EditValueChanged
lookUpEdit1.Properties.NullText = "(select or type value)"
Dim colors As String() = New String() {"Yellow", "Red", "Green", "Black", "White"}

winforms-grid-bind-to-business-objects/VB/GridBoundToRuntimeCreatedData/Form1.vb#L36

vb
' Specify a different null value text presentation for the Image column
gridView1.Columns("Image").RealColumnEdit.NullText = "[load image]"

winforms-scheduler-sync-google-event-colors-with-labels/VB/SchedulerGSync/SchedulerGSync/SyncOptionsForm.vb#L20

vb
Me.lookUpEdit1.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False
Me.lookUpEdit1.Properties.NullText = String.Empty
Me.lookUpEdit1.Properties.ShowHeader = False

See Also

Text

NullValuePrompt

NullDate

RepositoryItem Class

RepositoryItem Members

DevExpress.XtraEditors.Repository Namespace