Click here to Skip to main content
Licence 
First Posted 29 Oct 2004
Views 88,921
Bookmarked 18 times

Masked Edit Box in vb.net

By | 29 Oct 2004 | Article
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

About the Author

Edu001



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 PinmvpDave Kreskowiak8:38 2 Oct '09  
GeneralRead only PinmemberAJR 11210:17 17 May '06  
GeneralCauses exception Pinmemberingotaner4:54 25 Jan '06  
GeneralIt has wha I need PinmemberBe thankful4:42 2 May '05  
GeneralBad :( PinmemberAsaph10:45 3 Feb '05  
GeneralI am not getting this Masked Edit Box PinmemberManish Kauhsik19:51 12 Jan '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120517.1 | Last Updated 29 Oct 2004
Article Copyright 2004 by Edu001
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid