by Vanessa Waiters (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 22nd October 2004
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Validates value user enters into TextBox control for telephone number entry is valid. Format should be 999-999-9999.
API Declarations
Dim PN As String
'Set txtPNBox.Text lenghth to 12.
'Generate/display successful message for correct phone number format
'Generate/display unsuccessful message for incorrect phone number format
If txtPNBox.Text.Length() = 12 Then
MsgBox("Your number is correct.")
txtPNBox.Text = ""
Return
End If
If txtPNBox.Text.Length() <> 12 Then
MsgBox("Sorry! Your number format is incorrect. Please enter a valid number, e.g., 999-999-9999.")
Return
End If
End Sub
Private Sub txtInputNum_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPN.TextChanged
End Sub
Private Sub txtPNBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPNBox.TextChanged
End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub lblPN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblPN.Click
End Sub
Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub mnuEditItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuCloseItem.Click
'Set close menu to end session by returning a pleasant "Thank you" before exiting
If txtPNBox.Text = "" Then
MsgBox("Thank you and have a blessed day, good-bye!")
End
End If
End Sub
End Class
No comments have been posted about Validates value user enters into TextBox control for telephone number entry is valid. Format should. Why not be the first to post a comment about Validates value user enters into TextBox control for telephone number entry is valid. Format should.