LEFT and RIGHT functions

BergenBman

Newcomer
Joined
Sep 24, 2002
Messages
6
I can use the mid function to parse a string but when I try to use either the LEFT or Right functions to parse a string it doesn't recognize the functions
 
you have to use the SubString function. For example,
Visual Basic:
Dim str1, str2, str3, bigStr As String

bigStr = "Visual Basic .NET"

str1 = bigStr.SubString(0, 3)
str2 = bigStr.SubString(11)
str3 = bigStr.SubString(5,5)

str1 would be "Vis"
str2 would be "c .NET"
str3 would be "al Ba"

If you leave out the second parameter, it will just get the rest of
the string, from the character you specify. Otherwise it gets the
number of characters you specify after the first index you specify. Remember,
the params are Start and Length, not Start and End.

You should never use the Mid, Left and Right functions, because they
are part of the Visual Basic compatability library; something MS should
have left out, IMO.
 
Left and Right functions would work if you use the complete functions:

Microsoft.VisualBasic.Left(String,#)

or

Microsoft.VisualBasic.Right(String,#)
 
The Microsoft.VisualBasic.whatever functions are mostly bad
programming practice. They are there so that the VB6 project migration
wizard will not fumble (the wizard itself is bad practice). You should
stay away from them. I even check functions that I am using (if I am
not sure of the library) with the Object Browser to make sure they
are not part of this library.

Note that not all of the functions in this library should be militantly
avoided (CodeDom uses an interface from this namespace, if I recall
correctly), but the VB6 ones should.
 
Try This one

Well Dude

If you have used Visual Basic 6 and want to use functions in VB.NET

Just in project import this

Visual Basic:
imports Microsot.VisualBasic[CODE=visualbasic]

then in code down you can use your VB functions easily.
 
Dr. Madz, I guess you didn't read my post of two weeks ago (2 posts up ).

Also, there is no need to use any of the VB6 functions whilst in .NET.
 
Dear Ruby

I m Sorry, i am a new comer, and i dont know about any post. this is my first day here.
 
Back
Top