Check this one out.

I would like my program to auto add a dash while typing in a Social Security Number.

Example: User types in "1 2 3" and then my program inserts the first - (dash) user then types in "4 5" and my program inserts the last - (dash).

I tried using the code below but it places my cursor at the start of the text box afterward.

'Private Sub TextSSN_KeyUp(KeyCode As Integer, Shift As Integer)

'If Len(TextSSN.Text) = 3 Then TextSSN = TextSSN & "-"
'If Len(TextSSN.Text) = 6 Then TextSSN = TextSSN & "-"

'End Sub

Do you have an idea on how this can be done and make the cursor go to the end of the text line?

Thanks for reading this.