|
-
Dec 18th, 2008, 11:13 AM
#3
Thread Starter
New Member
Re: substring confusion
 Originally Posted by dbasnett
Code:
Dim someString As String = "012345"
Debug.WriteLine(someString.Substring(0, 2)) 'strings are zero based
Debug.WriteLine(someString.Substring(1, 2)) 'strings are zero based
Debug.WriteLine(someString.Substring(0, someString.Length - 1)) 'therefore number of chars. is length -1
'debug output
'01
'12
'1234
dbasnett - thanks for your quick response to a beginner. I understand your method, and can get the result I need using the (0,2) parameter. The big problem is the "ArgumentOutOfRangeException" which doesn't allow the program to execute. No matter which of the parameters I use, I can't run the program. Is there some Try-Catch statement I can use to run the program - some Catch statement which tells VB to ignore the perceived exception? Thanks again - joewillie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|