View Single Post
 
Old 12-03-2016, 01:01 PM
Jamarccus Jamarccus is offline
Newcomer
 
Join Date: Dec 2016
Posts: 1
Default Vb.net assignment

So I'm amidst taking my first programming class and now making a phone number validation function in a module that will decide whether or not a phone number is legit according to NANP guidelines.

What I'm feeling really stuck on is that when a number doesn't follow the guidelines I can't get the function to return a message or messagebox describing why the number isn't valid.

Here's a snippet of code showing what I can't figure out.

Option Strict On
Module PhoneNumberValidation

Public Function IsNumberValid(ByVal NumberInput As String) As Boolean

If NumberInput.Substring(1, 1).Equals("0") Or NumberInput.Substring(1, 1).Equals("1") Then

Return ("This number is invalid because Area Codes cannot begin with a 1 or 0.") ' <-- here's the message I want to return but it won't because it's a boolean value, if theres a way to change that, how so?


ElseIf NumberInput.Substring(1, 1).Equals("2") Then

End If

Return True

End Function

End Module



If anyone can help me out here I would appreciate it a ton!
Reply With Quote