Click here to Skip to main content
13,146,402 members (49,553 online)
Click here to Skip to main content
Add your own
alternative version


22 bookmarked
Posted 29 Oct 2004

Masked Edit Box in

, 29 Oct 2004
Rate this:
Please Sign up or sign in to vote.
Simple but flexible Masked Edit Box
<!-- Article Starts - DO NOT ADD HTML/BODY START TAGS-->

Sample Image - MaskedTextBox.jpg


This is a very easy to use Masked TextBox for fixed length strings like phone numbers, social security, driver license, etc. Not suitable for values as it is but you can customize it.


  • The "#" character in the mask is used for digit only
  • The "&" character accepts letter only
  • The "!" character accepts letter or digit
  • You can use any mask symbol, letter and digit other than # & and !
Ex. ###-&!/&&(###) ###-!!!! &&XXX##Z12&&&

Using Component

The use of this component is very simple. You have to select the toolbox panel, right click in the windows forms section and select customize toolbox.

Select .NET framework components, then click browse and select maskedtextbox.dll in the download path. The maskedbox component will appear at the end of windows forms panel. Now select the component and drop it on a form.

Then set the mask property with any combination of characters

At run time you can read the unformatedtext property to read only the user input.

The Text property returns the formated string.






This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
Dave Kreskowiak2-Oct-09 8:38
mvpDave Kreskowiak2-Oct-09 8:38 
GeneralRead only Pin
AJR 11217-May-06 10:17
memberAJR 11217-May-06 10:17 
GeneralCauses exception Pin
ingotaner25-Jan-06 4:54
memberingotaner25-Jan-06 4:54 
GeneralIt has wha I need Pin
Be thankful2-May-05 4:42
memberBe thankful2-May-05 4:42 
GeneralBad :( Pin
Asaph3-Feb-05 10:45
memberAsaph3-Feb-05 10:45 
GeneralI am not getting this Masked Edit Box Pin
Manish Kauhsik12-Jan-05 19:51
memberManish Kauhsik12-Jan-05 19:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170915.1 | Last Updated 29 Oct 2004
Article Copyright 2004 by Edu001
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid