Vb.net assignment
Vb.net assignment
Vb.net assignment
Vb.net assignment
Vb.net assignment
Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment
Vb.net assignment Vb.net assignment
Vb.net assignment
Go Back  Xtreme Visual Basic Talk > > > Vb.net assignment


Reply
 
Thread Tools Display Modes
  #1  
Old 12-03-2016, 02: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
  #2  
Old 12-03-2016, 10:24 PM
Cerian Knight's Avatar
Cerian KnightVb.net assignment Cerian Knight is offline
Polymath (in disciplina)

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,193
Default

Just an opinion, but your function definition seems too narrow. Yes, you might be able to solve this with overrides (though I'm not sure if return overrides exist) or something else. Why not just change this function definition or write another function called 'WhyIsNumberNotValid' (or, better yet, 'GetLastInvalidNumberErrorMessage') that returns a string?
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
Reply

Tags
function, numberinput.substring1, phone, guidelines, module, return, valid, phonenumbervalidation, snippet, strict, figure, option, code, string, invalid, codes, begin, numberinput, isnumbervalidbyval, boolean, 1.equals1, 1.equals0, public, follow, class


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Vb.net assignment
Vb.net assignment
Vb.net assignment Vb.net assignment
Vb.net assignment
Vb.net assignment
Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment Vb.net assignment
Vb.net assignment
Vb.net assignment
 
Vb.net assignment
Vb.net assignment
 
-->