By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

Microsoft.VisualBasic.String.Left

P: n/a
I have two questions with regards to the LEFT function.

I ran into a problem with the LEFT function today. I knew it was a valid
Function, but when I tried to use it, it was getting interpreted as the LEFT
location of a control or something like that, instead of the LEFT function.
(I want to extract the left portion of a string). Anyway, I knew what I
needed was to find out what IMPORTS I was missing. After finding a posting on
MSDN that spoke about a similar issue, I realized I did not need an imports,
but I need to refer to it like Microsoft.VisualBasic.String.Left and it
worked fine. In fact, using Microsoft.VisualBasic.String as an import did not
allow me to use just the LEFT function by itself. I'm assuming this si
because there is already another LEFT defined.

Now my questions.

1. I assume there is a better way of doing this now with VB.Net 2005 since I
need to reference it the way I did. Is there a different command I should be
using in VB.Net 2005 in place of the VB6 way of doing it?

2. I know of a method/function I want to use. In this case, it was LEFT.
But, I don't know the namespace I need to include in my Imports section.
Knowing the command I want to use, how can I find out what Imports I need to
reference to use it?

Thanks,
Greg
Oct 22 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"Greg" <Ac**********@newsgroups.nospamschrieb
I have two questions with regards to the LEFT function.

I ran into a problem with the LEFT function today. I knew it was a
valid Function, but when I tried to use it, it was getting
interpreted as the LEFT location of a control or something like
that, instead of the LEFT function. (I want to extract the left
portion of a string). Anyway, I knew what I needed was to find out
what IMPORTS I was missing. After finding a posting on MSDN that
spoke about a similar issue, I realized I did not need an imports,
but I need to refer to it like Microsoft.VisualBasic.String.Left and
it worked fine. In fact, using Microsoft.VisualBasic.String as an
import did not allow me to use just the LEFT function by itself. I'm
assuming this si because there is already another LEFT defined.

Now my questions.

1. I assume there is a better way of doing this now with VB.Net 2005
since I need to reference it the way I did. Is there a different
command I should be using in VB.Net 2005 in place of the VB6 way of
doing it?

TheString.SubString(0, ...)
2. I know of a method/function I want to use. In this case, it was
LEFT. But, I don't know the namespace I need to include in my
Imports section. Knowing the command I want to use, how can I find
out what Imports I need to reference to use it?
Alt+F12 (or "symbol search" in Edit menu): "Left" <enter>
Armin
Oct 22 '07 #2

P: n/a
"Greg" <Ac**********@newsgroups.nospamwrote in message
news:3A**********************************@microsof t.com...
>I have two questions with regards to the LEFT function.

I ran into a problem with the LEFT function today. I knew it was a valid
Function, but when I tried to use it, it was getting interpreted as the
LEFT
location of a control or something like that, instead of the LEFT
function.
(I want to extract the left portion of a string). Anyway, I knew what I
needed was to find out what IMPORTS I was missing. After finding a posting
on
MSDN that spoke about a similar issue, I realized I did not need an
imports,
but I need to refer to it like Microsoft.VisualBasic.String.Left and it
worked fine. In fact, using Microsoft.VisualBasic.String as an import did
not
allow me to use just the LEFT function by itself. I'm assuming this si
because there is already another LEFT defined.

Now my questions.

1. I assume there is a better way of doing this now with VB.Net 2005 since
I
need to reference it the way I did. Is there a different command I should
be
using in VB.Net 2005 in place of the VB6 way of doing it?

2. I know of a method/function I want to use. In this case, it was LEFT.
But, I don't know the namespace I need to include in my Imports section.
Knowing the command I want to use, how can I find out what Imports I need
to
reference to use it?

Thanks,
Greg
The LEFT, RIGHT and MID function all run fine in my copy of VS2005 Pro.
Perhaps you need to reference the Microsoft.Visualbasic library.
Oct 22 '07 #3

P: n/a
Thanks for the info on the Symbol Search. I was using the Object Browser and
it seems they both pretty much return the same thing, so I guess I must have
been on the right track. I just have a hard time finding something useful
sometimes using these tools.

Anyway, regarding the SubString method. I typed in my variable,
txtVariable... and SubString did not appear in the listing. Again, I figured
I was missing an Imports and I added System.String as one option. Still it
did not work. Just as I was getting ready to tell you it does not work, I
realized I needed to do it this way. txtVariable.TEXT.SubString(x,y). Now it
works just as needed.

Thanks.

Thanks,
Greg

"Armin Zingler" wrote:
"Greg" <Ac**********@newsgroups.nospamschrieb
I have two questions with regards to the LEFT function.

I ran into a problem with the LEFT function today. I knew it was a
valid Function, but when I tried to use it, it was getting
interpreted as the LEFT location of a control or something like
that, instead of the LEFT function. (I want to extract the left
portion of a string). Anyway, I knew what I needed was to find out
what IMPORTS I was missing. After finding a posting on MSDN that
spoke about a similar issue, I realized I did not need an imports,
but I need to refer to it like Microsoft.VisualBasic.String.Left and
it worked fine. In fact, using Microsoft.VisualBasic.String as an
import did not allow me to use just the LEFT function by itself. I'm
assuming this si because there is already another LEFT defined.

Now my questions.

1. I assume there is a better way of doing this now with VB.Net 2005
since I need to reference it the way I did. Is there a different
command I should be using in VB.Net 2005 in place of the VB6 way of
doing it?


TheString.SubString(0, ...)
2. I know of a method/function I want to use. In this case, it was
LEFT. But, I don't know the namespace I need to include in my
Imports section. Knowing the command I want to use, how can I find
out what Imports I need to reference to use it?

Alt+F12 (or "symbol search" in Edit menu): "Left" <enter>
Armin
Oct 22 '07 #4

P: n/a
On Oct 22, 3:30 pm, Greg <AccessVBA...@newsgroups.nospamwrote:
I have two questions with regards to the LEFT function.

I ran into a problem with the LEFT function today. I knew it was a valid
Function, but when I tried to use it, it was getting interpreted as the LEFT
location of a control or something like that, instead of the LEFT function.
(I want to extract the left portion of a string). Anyway, I knew what I
needed was to find out what IMPORTS I was missing. After finding a posting on
MSDN that spoke about a similar issue, I realized I did not need an imports,
but I need to refer to it like Microsoft.VisualBasic.String.Left and it
worked fine. In fact, using Microsoft.VisualBasic.String as an import did not
allow me to use just the LEFT function by itself. I'm assuming this si
because there is already another LEFT defined.
I used to reference the Left function with:

Imports Microsoft.VisualBasic = VB

VB.Left(string, 10)
>
Now my questions.

1. I assume there is a better way of doing this now with VB.Net 2005 since I
need to reference it the way I did. Is there a different command I should be
using in VB.Net 2005 in place of the VB6 way of doing it?
There is no direct replacement in the .NET framework. You can perform
the same effective function with the .Substring method in the String
class.
>
2. I know of a method/function I want to use. In this case, it was LEFT.
But, I don't know the namespace I need to include in my Imports section.
Knowing the command I want to use, how can I find out what Imports I need to
reference to use it?
The help file. I just did a search on "left string function" and one
of the the first hits was:

http://msdn2.microsoft.com/en-us/lib...ft(VS.80).aspx

Which clearly indicates that the function is referenced in the
Microsoft.VisualBasic namespace.

>
Thanks,
Greg

Oct 22 '07 #5

P: n/a
Hi Greg,

Would you mind letting me know the result of the suggestions? If you need
further assistance, feel free to let me know. I will be more than happy to
be of assistance.

Have a great day!

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 25 '07 #6

P: n/a
Just taking a moment to update you on where I'm at.

Rather than using the LEFT function from the Microsoft.VisualBasic library I
am using the SubString instead. I want to avoid using older VB 6.0 types of
methods and functions when at all possible.

"Jialiang Ge [MSFT]" wrote:
Hi Greg,

Would you mind letting me know the result of the suggestions? If you need
further assistance, feel free to let me know. I will be more than happy to
be of assistance.

Have a great day!

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 25 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.