Back to Devexpress

BaseEdit.EditValue Property

windowsforms-devexpress-dot-xtraeditors-dot-baseedit.md

latest8.4 KB
Original Source

BaseEdit.EditValue Property

Gets or sets the editor’s value.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[Bindable(true)]
[DefaultValue(null)]
[DXCategory("Data")]
public virtual object EditValue { get; set; }
vb
<Bindable(True)>
<DXCategory("Data")>
<DefaultValue(Nothing)>
Public Overridable Property EditValue As Object

Property Value

TypeDefaultDescription
Objectnull

An object representing the editor’s value.

|

Remarks

Setting this property to a new value raises the RepositoryItem.EditValueChanging event. The RepositoryItem.EditValueChanged event fires after the EditValue property value has been changed.

Use the BaseEdit.Text property to obtain the editor’s text representation of this value.

Example

The following example binds a CalcEdit editor to the Freight field in a data source (OrdersBindingSource).

csharp
calcEdit1.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", ordersBindingSource, "Freight", true));
vb
CalcEdit1.DataBindings.Add(New System.Windows.Forms.Binding("EditValue", OrdersBindingSource, "Freight", True))

Example

The following example uses the EditValue property to select the first lookup row in a LookUpEdit control.

csharp
private void btnSelectRow_Click(object sender, EventArgs e) {
    lookUpEdit1.EditValue = lookUpEdit1.Properties.GetDataSourceValue(lookUpEdit1.Properties.KeyMember, 0);
}
vb
Private Sub btnSelectRow_Click(sender As Object, e As EventArgs) Handles btnSelectRow.Click
    lookUpEdit1.EditValue = lookUpEdit1.Properties.GetDataSourceValue(lookUpEdit1.Properties.KeyMember, 0)
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the EditValue 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-mvvm-best-practices/CS/POCOBindableProperties/DataBindingViaMVVMContextUserControl.cs#L34

csharp
// Data binding for the Title property (via MVVMContext API)
mvvmContext.SetBinding(editor, e => e.EditValue, "Title");
// UI binding for the Report command

reporting-winforms-label-report-in-code/CS/Reporting_how-to-create-a-label-report-at-runtime-t473792/Form1.cs#L34

csharp
Convert.ToSingle(RightMarginSpinEdit.EditValue),
Convert.ToInt32(lookUpPaperType.EditValue)
);

winforms-scheduler-print-appointments-using-reports/CS/PrintingViaReports/MyAppointmentEditForm.cs#L137

csharp
else
                timeEnd.EditValue = new DateTime(controller.DisplayEnd.TimeOfDay.Ticks);
;

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

csharp
public object ItemID {
    get { return TextEdit1.EditValue; }
    set { TextEdit1.EditValue = value; }

winforms-grid-enable-editing-in-group-row-to-change-cell-values/CS/WindowsApplication3/GroupEditProvider.cs#L168

csharp
if (edit == null || !edit.Visible) return;
if (edit.IsModified && edit.EditValue != null && updateValues)
    SetChildRowValues(edit);

winforms-mvvm-best-practices/VB/POCOBindableProperties/DataBindingViaMVVMContextUserControl.vb#L32

vb
' Data binding for the Title property (via MVVMContext API)
mvvmContext.SetBinding(editor, Function(e) e.EditValue, "Title")
' UI binding for the Report command

reporting-winforms-label-report-in-code/VB/Reporting_how-to-create-a-label-report-at-runtime-t473792/Form1.vb#L26

vb
Dim builder As New CustomLabelReportBuilder()
Dim labelReport As XtraReport = builder.GenerateLabelReport(Convert.ToSingle(LabelWidthSpinEdit.EditValue), Convert.ToSingle(LabelHeightSpinEdit.EditValue), Convert.ToSingle(VerticalPitchSpinEdit.EditValue), Convert.ToSingle(HorizontalPitchSpinEdit.EditValue), DirectCast(UnitComboBox.EditValue, DevExpress.Drawing.DXGraphicsUnit), Convert.ToSingle(BottomMarginSpinEdit.EditValue), Convert.ToSingle(TopMarginSpinEdit.EditValue), Convert.ToSingle(LeftMarginSpinEdit.EditValue), Convert.ToSingle(RightMarginSpinEdit.EditValue), Convert.ToInt32(lookUpPaperType.EditValue))
Return labelReport

winforms-scheduler-print-appointments-using-reports/VB/PrintingViaReports/Form1.vb#L147

vb
cbView.EditValue = schedulerControl1.ActiveViewType
    rgrpGrouping.EditValue = schedulerControl1.GroupType
End Sub

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

vb
Get
    Return TextEdit1.EditValue
End Get

winforms-grid-enable-editing-in-group-row-to-change-cell-values/VB/WindowsApplication3/GroupEditProvider.vb#L162

vb
End If
If edit.IsModified AndAlso edit.EditValue IsNot Nothing AndAlso updateValues Then
    SetChildRowValues(edit)

See Also

OldEditValue

Text

EditValueChanging

EditValueChanged

GetDataSourceValue

BaseEdit Class

BaseEdit Members

DevExpress.XtraEditors Namespace