Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top