Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

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
0
VinnyG3
Asked:
VinnyG3
  • 4
  • 4
1 Solution
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
VinnyG3Author Commented:
Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now