SSN format code

I am trying to write code so that when a customer enters in a SSN it adds the dashes in for them, so it would appear like so. xxx-xxx-xxxx.  

Thanks,

Tyler
VinnyG3Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DhaestCommented:
This is a simple string manipulation, that doesn't require a regular expression:

    Dim input As String = "123456789"
    Dim output As String = input.Insert(3, "-").Insert(6, "-")
0
Patrick MatthewsCommented:
Or, if this is VB 6 or VBA...

Debug.Print Format(SSN, "000-00-0000")
0
DhaestCommented:
Like matthewspatrick said: what programming language are you using ?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

VinnyG3Author Commented:
I am using VB express 2005
0
VinnyG3Author Commented:
Also is there a way to do this so that while entering the SSN it adds the dashes. Meaning that I dont have to have an out put before it enters the dashes.

Thanks,

Tyler
0
DhaestCommented:
The Masked Edit Control is one of the standard components. (Right Mouse on the controls bar and select components) Scroll down in the Components Dialog until you see 'Microsoft Masked Edit Control'.
Click the checkbox next to the name and click 'OK'.

Click on the new control when it showS up in your controls bar and draw the control on the form.

Set the mask property to your pattern examole would be "###-###-####". the # character forces numeric input.
0
VinnyG3Author Commented:
Im not sure on what you are talking about, on where to find the masked edit control.

Thanks,

Tyler
0
DhaestCommented:
Here is a free .NET control someone built for MaskedEditBox:
http://www.codeproject.com/vb/net/cpflexmaskeditbox.asp

Masked Edit Box in vb.net
http://www.codeproject.com/KB/vb/MaskedTextBox.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VinnyG3Author Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.