Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

Very simple: MaskedTextBox property

I want 3 first characters of the string in this maskedtextbox always to be CS1. How can I do that. For example:
--------------------
CS1AAAAAAAA
CS1BBBBBBBBB
CS1CCCCCCCC
--------------------
Thank you.
0
maidinhtai
Asked:
maidinhtai
  • 2
1 Solution
 
vadim63Commented:
The mask "\CS1>LLLLLLLL" gives you
CS1 and 8 required letters in upper case
0
 
vadim63Commented:
Masking element           Description
 
0   Digit, required. This element will accept any single digit between 0 and 9.
 
9   Digit or space, optional.
 
#   Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in the Text property. Plus (+) and minus (-) signs are      allowed.
 
L    Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z] in regular expressions.
 
?    Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z]? in regular expressions.
 
&   Character, required. If the AsciiOnly property is set to true, this element behaves like the "L" element.
 
C   Character, optional. Any non-control character. If the AsciiOnly property is set to true, this element behaves like the "?" element.
 
A   Alphanumeric, optional. If the AsciiOnly property is set to true, the only characters it will accept are the ASCII letters a-z and A-Z.
 
a   Alphanumeric, optional. If the AsciiOnly property is set to true, the only characters it will accept are the ASCII letters a-z and A-Z.
 
.    Decimal placeholder. The actual display character used will be the decimal placeholder appropriate to the format provider, as determined by the control's FormatProvider property.
 
,    Thousands placeholder. The actual display character used will be the thousands placeholder appropriate to the format provider, as determined by the control's FormatProvider property.
 
:    Time separator. The actual display character used will be the time placeholder appropriate to the format provider, as determined by the control's FormatProvider property.
 
/    Date separator. The actual display character used will be the date placeholder appropriate to the format provider, as determined by the control's FormatProvider property.
 
$    Currency symbol. The actual character displayed will be the currency symbol appropriate to the format provider, as determined by the control's FormatProvider property.
 
<    Shift down. Converts all characters that follow to lowercase.
 
>    Shift up. Converts all characters that follow to uppercase.
 
|     Disable a previous shift up or shift down.
 
\     Escape. Escapes a mask character, turning it into a literal. "\\" is the escape sequence for a backslash.
 
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.
0
 
maidinhtaiAuthor Commented:
That's it: \. Thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now