Question

When I try to use a masked textbox in my project, I saw that 00000 and 99999 give the same result of _____ in my masked textbox.

Is 0 and 9 is the same in a mask of my masked textbox? If any difference: what are all that?

Please explain.

Was it helpful?

Solution

Take a look at the documentation of the Mask property:

Masking element     Description
---------------     -----------
0                   Digit, required.This element will accept any single digit between 0 and 9.
9                   Digit or space, optional. 

They're not the same, but every piece of the mask that is not a literal character to be included (like date or time separators or the dots in an IP address) will become an underscore to indicate that they are a place to enter stuff.

OTHER TIPS

0 Digit, required. This element will accept any single digit between 0 and 9.

9 Digit or space, optional.

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

000000 and 999999 has give the same __ in our WinForm. Don't Confuse. Its all refer the Same Digit. But You can use 0 is a must enter values like 00-00-0000 as date.

And 9 is ref Optional. like 999 as _96.

If you want use 0 and 9 as number in Masked Textbox,.. you can use \ before.

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