Questions tagged [maskedtextbox]

A useful .NET control that allows a user to display and edit values based on the mask defined.

The MaskedTextBox class is a .NET/Windows Forms enhanced TextBox control that supports a declarative syntax for accepting or rejecting user input.

For example, in order to get a phone number in the format (505) 55 555 555, MaskedTextBox is preferred.

Using the Mask property, you can specify the following input without writing any custom validation logic in your application:

  • Required input characters.

  • Optional input characters.

  • The type of input expected at a given position in the mask; for example, a digit, or an alphabetic or alphanumeric character.

  • Mask literals, or characters that should appear directly in the MaskedTextBox; for example, the hyphens (-) in a phone number, or the currency symbol in a price.

  • Special processing for input characters; for example, to convert alphabetic characters to uppercase.

For more information, see MaskedTextBox Class (MSDN).

261 questions
-1
votes
1 answer

Checking of masked text box

I have five masked text box in my form. Two masked text box with date format, two with money and one with phone number. i am using code given below for checking these boxes are empty or not. Dim mtxt As Control Dim flagmtxt As Boolean …
Thanzeem
  • 133
  • 5
  • 13
  • 22
-2
votes
4 answers

How do I validate an input requiring two hex characters?

I want to validate a string value from textbox. Validation requirements are: Exactly 2 characters Hex characters only How can I do this?
mixo_17
  • 127
  • 1
  • 1
  • 8
-2
votes
2 answers

C# || operator not working for masked textboxes

I want to validate two masked textboxes. At least one of them needs to have a value. I have the following code bool validatePhoneNumbers() { bool valid = false; if (!txtClientFax.MaskCompleted || !txtClientMobile.MaskCompleted) { …
lucy
  • 7
  • 1
-2
votes
2 answers

Cannot implicitly convert type 'string' to 'int' where input can be numeric or alphanumeric.

I'm trying to make a masked Textbox that has a partial value already set and then the user needs to enter 4 more digits then allow it to send out. I've had a hard time trying to explain but here's what it currently looks like for reference: private…
x66dme66x
  • 11
  • 1
-2
votes
3 answers

How convert string (masked) to decimal?

I have mask in textbox "99:99" I need convert to decimal. example: string "12:34" converted to 12.34 I create method: private decimal ConvertStringMaskToDecimal(string strMask) { var split = strMask.Split(':'); if(split.Length==2) { …
Mediator
  • 14,951
  • 35
  • 113
  • 191
-3
votes
3 answers

What is the difference between 00000 and 99999 in masked textbox?

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.
Sagotharan
  • 2,586
  • 16
  • 73
  • 117
1 2 3
17
18