Please tell me whether it is possible to implement, and if so, how, such a venture. TextBox, in it a mask for entering three words - a full name. I tried this mask: "LLL", it certainly did not work, because allows you to enter one character between spaces, but you need an unlimited number of characters. I don’t want to use regulars here, it’s necessary that the textbox should have underscores indicating the place to enter
- 2TextBox is in WPF and WinForms, specify the desired tag. - Bulson
|
1 answer
Using a mask does not solve it. You need to validate input post factum. Option two:
- Validation of characters at the input stage. A simple option is to respond to keystrokes, an advanced version is to fully validate (WinForms). A similar solution can be made for WPF.
- Validation of the entered text entirely using regular expressions.
If you want to check the Russian full name, then remember that in addition to letters, at least they may also contain hyphens. If you want to check also foreign names written in Cyrillic, then everything becomes even more complicated: here you have numbers, apostrophes, commas, periods, and the devil knows what else. And if foreign names are also in the original, then everything is generally bad :).
- Thank you so much for an exhaustive answer) I will use the regulars then - Antykus
- @Antykus is not for nothing! You can mark it as true (daw to the left of the answer). - andreycha
|