User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 427,809 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,842 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums

LEFT syntax

Join Date: Dec 2002
Location: West Virginia
Posts: 388
Reputation: waynespangler is on a distinguished road 
Rep Power: 6
Solved Threads: 40
waynespangler waynespangler is offline Offline
Posting Whiz

Re: LEFT syntax

  #4  
Apr 28th, 2007
Your problerm is if you have a string length of 5 and you are starting at the third position(2) and then going 5 more positions then you are past the end of your line. Same thing with length of 7.
        'If Not (IsNumeric(strOrderNo.Substring(2, 5)) Or _
        'IsNumeric(strOrderNo.Substring(2, 7))) Then
Like vb6 if you did not give mid$ a second number it would take all the numbers from that starting position, substring does the same thing. So you do not need to check if it is 5 or 7 characters long.
        If Not IsNumeric(strOrderNo.Substring(2)) Then

One other thing in this code:
If Not (Len(strOrderNo) >= 5 And Len(strOrderNo) <= 7) Then
if 4 numbers are entered it will accept them. I don't know if it is a typeing error or not but you said "followed with 3 or 5 number." If so then change it to the following"
 If Len(strOrderNo) <> 5 Or Len(strOrderNo) <> 7 Then
Hope this helps.
Reply With Quote  
All times are GMT -4. The time now is 2:26 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC