Back to Devexpress

ProcessNewValueEventArgs.DisplayValue Property

windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-processnewvalueeventargs.md

latest5.1 KB
Original Source

ProcessNewValueEventArgs.DisplayValue Property

Gets or sets the value entered by the end-user.

Namespace : DevExpress.XtraEditors.Controls

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public object DisplayValue { get; set; }
vb
Public Property DisplayValue As Object

Property Value

TypeDescription
Object

An object representing the value entered by the end-user.

|

Remarks

When the end-user enters text within the lookup editor’s edit box that does not match the RepositoryItemLookUpEditBase.DisplayMember field value of any dropdown row, the RepositoryItemLookUpEditBase.ProcessNewValue event is fired. The DisplayValue property specifies the value entered converted to the type of the RepositoryItemLookUpEditBase.DisplayMember field.

If the value entered cannot be converted to this field type, however, then the DisplayValue property will contain the value entered as a string type.

Generally, you use the RepositoryItemLookUpEditBase.ProcessNewValue event in order to add a new row to the dropdown list. When adding a new row, you normally need to set its RepositoryItemLookUpEditBase.DisplayMember field value to DisplayValue. In this case, if you then set the ProcessNewValueEventArgs.Handled property to true , the editor will locate and retrieve the new record after performing your RepositoryItemLookUpEditBase.ProcessNewValue event handler.

The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayValue 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.

how-to-use-the-processnewvalue-event-of-a-lookup-editor-e285/CS/Form1.cs#L43

csharp
private void LookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e) {
    Console.WriteLine("LookUpEdit1_ProcessNewValue: {0}", e.DisplayValue);

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

csharp
GridLookUpEdit gridLookup = sender as GridLookUpEdit;
if (e.DisplayValue == null) return;
string newValue = e.DisplayValue.ToString();

how-to-use-the-processnewvalue-event-of-a-lookup-editor-e285/VB/Form1.vb#L44

vb
Private Sub LookUpEdit1_ProcessNewValue(ByVal sender As Object, ByVal e As DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs)
    Console.WriteLine("LookUpEdit1_ProcessNewValue: {0}", e.DisplayValue)
    Dim Row As DataRow

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

vb
Dim gridLookup As GridLookUpEdit = TryCast(sender, GridLookUpEdit)
If e.DisplayValue Is Nothing Then Return
Dim newValue As String = e.DisplayValue.ToString()

See Also

Handled

ProcessNewValueEventArgs Class

ProcessNewValueEventArgs Members

DevExpress.XtraEditors.Controls Namespace