1

What is the mask for "percentage", in a WinForms application (VB.net)?

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
Chatur
  • 331
  • 1
  • 8
  • 17

2 Answers2

3

Per the documentation here: http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx

\ Escape. Escapes a mask character, turning it into a literal. "\\" is the escape sequence for a backslash.

So the mask for a % sign is \%

Before posting, I made up a quick and dirty winforms app, tried it and it works.

Edit - added although this next item in the documentation makes it look like just a straight % sign should work without the backslash, so I tried it and it works as well.

All other characters Literals. All non-mask elements will appear as themselves within MaskedTextBox. Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user.

David
  • 72,686
  • 18
  • 132
  • 173
0
textEdit1.Properties.Mask.MaskType = Numeric;
textEdit1.Properties.Mask.EditMask = "00.00%%";
textEdit1.Properties.Mask.UseMaskAsDisplayFormat = true;

http://community.devexpress.com/forums/t/59535.aspx

onurbaysan
  • 1,248
  • 8
  • 27