Skip to main content

CalcEdit Class

A text editor with a built-in drop-down calculator for numeric value input.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v25.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultBindingPropertyEx("Value")]
public class CalcEdit :
    PopupBaseEdit

The following members return CalcEdit objects:

Remarks

CalcEdit is a text editor that opens a drop-down calculator for numeric input. The calculator supports basic arithmetic operations, inverse calculation, and a memory register.

CalcEdit - WinForms Calc Editor, DevExpress

Run Demo: CalcEdit

The following code snippet creates a CalcEdit control with the specified value:

using DevExpress.XtraEditors;

CalcEdit calcEdit = new CalcEdit() {
    Location = new System.Drawing.Point(12, 12),
    Value = 100.5m
};

this.Controls.Add(calcEdit);

Edit Value

Use the Value property to specify a decimal value:

calcEdit1.Value = 42.5m;
decimal result = calcEdit1.Value;

Use the EditValue property to work with a value of any type. The editor converts EditValue to decimal when the drop-down calendar opens or when the editor is validated.

Handle the ValueChanged event to respond to value changes.

Validation Behavior

When users move focus to another control or press Enter (if ValidateOnEnterKey is true), the editor converts the value to decimal. If the conversion fails, EditValue is set to 0.

Customize CalcEdit Settings

Use the Properties property to access and customize editor settings.

Property Name Description
TextEditStyle Specifies the editor’s display mode. TextEditStyles.DisableTextEditor prevents users from typing in the edit box.
DisplayFormat Specifies the display format for the edit value when the editor does not have focus.
MaskSettings Specifies the input mask.

Enter Numeric Values

Refer to the following help topic for additional information on numeric editors: Data Editors with Numeric Input Support.

Inheritance

See Also