Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top