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).

258 questions
60
votes
5 answers

Enter key pressed event handler

I want to capture the text from the textbox when enter key is hit. I am using WPF/visual studio 2010/.NET 4. I dont know what event handler to be used in the tag ? I also want to do the same for maskedtextbox.
zack
  • 6,395
  • 14
  • 49
  • 61
46
votes
11 answers

Convert Difference between 2 times into Milliseconds?

I have two masked TextBox controls and was wondering how I'd go about getting the time in each one and then converting the difference into milliseconds. Like, say in tb1 I write "12:01" and in tb2 I write "12:02", and then click a button. Once the…
jay_t55
  • 10,203
  • 26
  • 92
  • 167
35
votes
8 answers

masked input not working in android mobiles?

I am using the digitalbush masked input jQuery plugin. It is working fine in web browsers and the iPhone browser perfectly, but it is not working for Android mobile devices. My issue : mask is in input field _ - _ - ___. When I type numbers it will…
Durga Prasad
  • 897
  • 2
  • 11
  • 17
16
votes
7 answers

How to get the jQuery MaskedInput unmask() function to work properly?

I am trying to have one input on my page that I would like to have a U.S. phone number mask by default. If a end user clicks a checkbox specifing they would like to enter a International phone number I want the mask to be removed. I have tried…
Terry Nederveld
  • 704
  • 1
  • 6
  • 14
12
votes
6 answers

IP Address in a MaskedTextBox?

How can I use a MaskedTextBox to prevent the user from entering an invalid IP address? (I want it to behave just like the Windows one).
Nasreddine
  • 33,475
  • 17
  • 73
  • 91
10
votes
3 answers

Is it possible to use KnockoutJS with a masked input?

I´m using that plugin : https://github.com/plentz/jquery-maskmoney to format my money editor... I tried to use KnockoutJS in that editor, but it does not work... Without that mask all works fine... My code test is simple :
Paul
  • 11,619
  • 20
  • 62
  • 95
9
votes
1 answer

Is there a reference for MaskEdit's masks?

I'm trying to make a semi-complex masking textbox in Delphi 7. I'm having problems in that I can't find any kind of reference for what each character in a mask means. All I can find are examples. Is there a reference somewhere?
Earlz
  • 57,517
  • 89
  • 275
  • 484
7
votes
5 answers

Bind nullable DateTime to MaskedTextBox

I have a masked text box bound to a nullabe datetime, but when the date is blanked out, the validation on the masked text box won't complete. Is there a way to force this behaviour? I want a blanked out text box to equal a null DateTime. When the…
Aaron Smith
  • 3,202
  • 4
  • 26
  • 24
7
votes
2 answers

Masked TextBox how to not show underlines in text box and allow user to enter 3 digits

I am having some troubles with a masked textbox. How can I hide those underlines which are shown in the textbox by default?! Also I want the user be able to enter up to 3 digits (he/she can enter atleast 1 and maximum 3 digits). how to set that?
Saeid Yazdani
  • 12,365
  • 48
  • 158
  • 270
7
votes
2 answers

MaskedTextBox.SelectAll on GotFocus doesn't work with mouse

I want to select all the contents of a MaskedTextBox when the clicks (or tabs onto) the control, so they can easily replace the old content. I tried calling SelectAll() in the Enter event, but that didn't work at all. I switched to using the…
Jeff B
  • 7,565
  • 15
  • 53
  • 128
7
votes
4 answers

How to check if Masked textbox is empty?

I have several textboxes and masked texboxes in a winform that I need to check if they are empty, null or nothing before proceeding. The code I have for the most part is working as intended, if there is an empty texbox I get a message telling the…
David
  • 143
  • 1
  • 4
  • 13
6
votes
3 answers

How to get raw text from MaskedTextBox?

I have a MaskedTextBox with this mask (999) 999 9999. When user inputs a number the text property would give this to me : (0881) 444 5445 But I want to save the raw text to database field like this: 08814445445. How can I do that?
6
votes
3 answers

Right to left typing in text box?

I have a Currency Textbox with a mask. Mask is shown in textbox as --------.-- So user types in digits over the mask. Now customer says he does not want to type in letter from left to right. He wants to type from right to left. Similar to what we…
user1331032
  • 232
  • 1
  • 3
  • 11
6
votes
1 answer

WPF MaskedTextBox value binding (binding without the mask)

This is my masked textbox from the WPF Extended Toolkit The binding back to the property is including the mask. For example, when I enter…
Chris Klepeis
  • 9,204
  • 16
  • 80
  • 147
6
votes
1 answer

Anybody Know of any jQuery Mask Plugin that works with MVC Unobtrusive Validation?

I've always used the following mask input plugin in my ASP.Net applications: http://digitalbush.com/projects/masked-input-plugin/ Unfortunately, this doesn't play well with MVC unobtrusive validation. Validation fires on every keyup which is…
1
2 3
17 18