SidAhmed
SidAhmed

Reputation: 2362

Numeric TextEdit control +/- sign

I'm using Devexpress TextEdit control in my dialog form, and what I want to achieve, is to give the + sign to the typed value if it's greater than 0. The current EditMask value is set to n2.

For example :

If the user type 5.00, the control must show +5.00.

The user is also allowed to type a negative values. Is there some mask I should use, or a regular expression pattern ? Thanks in advance.

Upvotes: 0

Views: 2723

Answers (1)

DmitryG
DmitryG

Reputation: 17850

Try the the ';' character to separate the masks for positive and negative values:

textEdit1.Properties.Mask.EditMask = "+#0.00;-#0.00";
textEdit1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
textEdit1.Properties.Mask.UseMaskAsDisplayFormat = true;

Related link: Mask Type: Numeric

Upvotes: 2

Related Questions