LEFT Function?

jmancuso

Member
Joined
Feb 4, 2005
Messages
22
Programming Experience
1-3
Okay, just learning VB .NET migrating from VBA and VB 6.0. This should be super easy but I cant seem to get the LEFT Function to work. Does VB .NET support this?

Thanks.
 
have you tried using
microsoft.visualbasic as an import??

if no, then try adding it as imports...

if you have then what are you trying to do and can you give me some more details as to what it is that your try to accomplish...

regards
cjay
 
Importing the namespace isn't necessary. The Imports statement is a sort of shortcut so that you don't have to type the namespace again and again. Although it would work.
You could do something like this:
VB.NET:
Dim str As String = Microsoft.VisualBasic.Left("Test", 2) ' str = "Te"

The more .NET way of doing that is to use the SubString Function of the String class. The above code would become:
VB.NET:
Dim str2 As String = "Test".Substring(0, 2)  ' str2 = "Te"
 
Thank you for all the input on this. I figured out how to get it working using

Microsoft.VisualBasic.Left(string,2)

And thank you for the info on the substring function!!!
 
Back
Top