This the waring I get:
Warning 4 Function 'UnmaskSSN' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
Warning 4 Function 'UnmaskSSN' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
Code:
Private Function UnmaskSSN(ByVal SSN As String) As String
' Yank dashes out of the SSN in the masked textbox
If SSN = " - - " Then
SSN = "d"
Else
If Len(SSN) = 11 Then
Dim UnmaskedSSN As String = Microsoft.VisualBasic.Left(SSN, 3) & Microsoft.VisualBasic.Mid(SSN, 5, 2) & Microsoft.VisualBasic.Right(SSN, 4)
Return UnmaskedSSN
Else
SSN = "d"
MessageBox.Show("The SSN entered is not complete." & vbCrLf & "Please try again.", _
"CT Guide Request Search", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Me.txtSSN.Focus()
End If
End If
End Function
Comment