Click here to Skip to main content
15,506,599 members
Articles / Programming Languages / Visual Basic
Article
Posted 29 Oct 2004

Stats

122.2K views
2.6K downloads
22 bookmarked

Masked Edit Box in vb.net

Rate me:
Please Sign up or sign in to vote.
2.24/5 (12 votes)
29 Oct 2004
Simple but flexible Masked Edit Box

Sample Image - MaskedTextBox.jpg

Introduction

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.

Details

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

 

 

 

 

License

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


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 1 Pin
Dave Kreskowiak2-Oct-09 9:38
mveDave Kreskowiak2-Oct-09 9:38 
GeneralRead only Pin
AJR 11217-May-06 11:17
AJR 11217-May-06 11:17 
GeneralCauses exception Pin
ingotaner25-Jan-06 5:54
ingotaner25-Jan-06 5:54 
GeneralIt has wha I need Pin
msxkim2-May-05 5:42
msxkim2-May-05 5:42 
GeneralBad :( Pin
Pablo Robert3-Feb-05 11:45
Pablo Robert3-Feb-05 11:45 
GeneralI am not getting this Masked Edit Box Pin
Manish Kaushik12-Jan-05 20:51
Manish Kaushik12-Jan-05 20: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.