Solved

Input Mask for a Textbox.

Posted on 2008-10-09
6
1,296 Views
Last Modified: 2012-05-05
Hi, I'm using VB 2005, WinForms. I have two Textboxes on my Form that contain telephone numbers. My Database Table has an input mask for these fields that put the phone numbers into the following format:  (999) 999-9999.

How can I do the same with a Textbox? Would I have to write code to determine which number position is being entered and then assign the proper formatting, or is there a telephone number mask, like the password character mask, that can be applied here in some way?

Thanks,
Fulano
0
Comment
Question by:Mr_Fulano
6 Comments
 
LVL 16

Accepted Solution

by:
sh0e earned 500 total points
ID: 22684465
Use a MaskedTextBox control.  Go to the mask property and click the "..."
There is a predefined "phone number" mask.
0
 
LVL 14

Expert Comment

by:raja_ind82
ID: 22684467
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 22684473
there is not a telephone number mask but there is a control that support masks: MaskedTextBox. Just use it instead of TextBox, and set the Mask property.
http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 16

Expert Comment

by:sh0e
ID: 22684504
Screenshot showing what I am talking about.
untitled.PNG
0
 

Author Closing Comment

by:Mr_Fulano
ID: 31504917
Very good and simple solution.
0
 

Author Comment

by:Mr_Fulano
ID: 22684610
Thanks to all, but Sh0e had the best solution of all, which is what I needed. I actually didn't even know this control existed! Wow, live and learn...this is why I like this forum so much!!!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now