how make textbox or masked textbox take month and year only such as "mm/yyyy"
-
i can`t make it in textbox but in masked textbox i make the mask "00\0000" but user can enter month greater than 12 so i want to restrict this or make valdation type the mask follow so user can`t enter > 12 or <1 or > this year how ? :-) or can i make new type ("mm\yyyy") :confused:
-
i can`t make it in textbox but in masked textbox i make the mask "00\0000" but user can enter month greater than 12 so i want to restrict this or make valdation type the mask follow so user can`t enter > 12 or <1 or > this year how ? :-) or can i make new type ("mm\yyyy") :confused:
Rather than a MaskedTextBox, why not use a DateTimePicker? That way the date is always valid, and it is obvious regardless of locale. If you can't, then you would be best to use a ValidatingType property[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
-
i can`t make it in textbox but in masked textbox i make the mask "00\0000" but user can enter month greater than 12 so i want to restrict this or make valdation type the mask follow so user can`t enter > 12 or <1 or > this year how ? :-) or can i make new type ("mm\yyyy") :confused:
Hello Mohamed, I don't know if it would fit in your scenario, but I'd advise you to try to use a datetime picker where Format property is set to custom. Cheers Manfred
-
i can`t make it in textbox but in masked textbox i make the mask "00\0000" but user can enter month greater than 12 so i want to restrict this or make valdation type the mask follow so user can`t enter > 12 or <1 or > this year how ? :-) or can i make new type ("mm\yyyy") :confused:
-
i can`t make it in textbox but in masked textbox i make the mask "00\0000" but user can enter month greater than 12 so i want to restrict this or make valdation type the mask follow so user can`t enter > 12 or <1 or > this year how ? :-) or can i make new type ("mm\yyyy") :confused:
The maskedtextbox is described here[^], and it's usage is explained with a nice example at the bottom of that page. You'd set the mask to "00/0000" according the example, but I bet that it takes somewhat more customizing than merely changing the mask.
Mohamed Nabawy wrote:
can i make new type ("mm\yyyy")
You could create a new class that encapsulates both a month and a year. The current edit-controls would not know how to interact with your class, unless you also create a
TypeConverter
. I suggest you keep it simple and put two textboxes on that form; limit the keys that can be entered to numbers. Done :)I are Troll :suss: