Link to home
Start Free TrialLog in
Avatar of Mr_Fulano
Mr_FulanoFlag for United States of America

asked on

Input Mask for a Textbox.

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
ASKER CERTIFIED SOLUTION
Avatar of sh0e
sh0e

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Avatar of sh0e
sh0e

Screenshot showing what I am talking about.
untitled.PNG
Avatar of Mr_Fulano

ASKER

Very good and simple solution.
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!!!