How can I do so that when writing a Number series in a TextBox, it automatically places a hyphen?
For example if I put in the textbox 00726022
automatically put a hyphen and it is shown like this 00726-02-2
Beforehand thank you very much
How can I do so that when writing a Number series in a TextBox, it automatically places a hyphen?
For example if I put in the textbox 00726022
automatically put a hyphen and it is shown like this 00726-02-2
Beforehand thank you very much
You can use the MaskedTextBox control with a custom mask, to do this go to the tool palette and insert said control, then go to the Mask property and put the following mask there:
In this way you tell the MaskedTextBox that it will have a format of any 5 numbers, then a hyphen "-" would come , then another two numbers, then another hyphen "-" and finally another two numbers.
The use of masks is important, since they reduce code and make the application easier to maintain, you can create masks for dates, postal codes, vehicle license plates, etc.