Solved

Input Mask for a Textbox.

Posted on 2008-10-09
6
1,299 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 Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP/VB email question 4 46
VB.net and sql server 4 45
ASP.NET (VB) return a record 2 37
Access/Visual Basic Question 3 24
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 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