Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 109,297 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,225 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



SSN formatting

 
Reply to this topicStart new topic

SSN formatting

ramonagail
post 1 Aug, 2008 - 07:47 AM
Post #1


New D.I.C Head

*
Joined: 1 Aug, 2008
Posts: 1

How do I strip the dashes out of an SSN?

...and why is it so hard to find answers to these simple little things in the vb.net books? Do they have the questions in secret-geek-code or something? blink.gif
User is offlineProfile CardPM

Go to the top of the page


PsychoCoder
post 1 Aug, 2008 - 07:57 AM
Post #2


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,238



Thanked 52 times

Dream Kudos: 7775

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI

My Contributions


You can use the Replace Method and replace all dashes with "". Like so


vb

Private Function StripDashes(ByRef ssn As String) As String
'First make sure we have a valid length string
If ssn.Length = 11 Then
'Return theSSN without the dashes
ssn = ssn.Replace("-", "")
Else
'Not a valid length
MessageBox.Show("Invalid SSN length")
End If

Return ssn
End Function


Hope this helps smile.gif
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/6/08 09:47AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month