What is the mask for "percentage", in a WinForms application (VB.net)?
Asked
Active
Viewed 4,813 times
1
-
Do you mean: "How do I include the '%' into a MaskedTextBox ?" – serhio Jul 02 '10 at 15:26
2 Answers
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;

onurbaysan
- 1,248
- 8
- 27