Solved

Input Mask for a Textbox.

Posted on 2008-10-09
6
1,298 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

13 Experts available now in Live!

Get 1:1 Help Now