471,596 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,596 software developers and data experts.

Left, Right Functions

I have:

If (Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "$") Then

TextBox1.Text = Microsoft.VisualBasic.Right(TextBox1.Text,
TextBox1.Text.Length - 1)

End If

Adding: Imports Microsoft.VisualBasic

And removing the "Microsoft.VisualBasic" from the Left and Right functions
gives me a compile error.

Why?


Nov 21 '05 #1
11 4892

"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...
I have:

If (Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "$") Then

TextBox1.Text = Microsoft.VisualBasic.Right(TextBox1.Text,
TextBox1.Text.Length - 1)

End If

Adding: Imports Microsoft.VisualBasic

And removing the "Microsoft.VisualBasic" from the Left and Right functions
gives me a compile error.

Why?


Never mind. I just read where these functions must be fully qualified...

Thanks...
Nov 21 '05 #2
"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...
I have:
If (Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "$") Then
TextBox1.Text = Microsoft.VisualBasic.Right(TextBox1.Text,
TextBox1.Text.Length - 1)
End If

Adding: Imports Microsoft.VisualBasic
And removing the "Microsoft.VisualBasic" from the Left and Right
functions gives me a compile error.


I agree, it /shouldn't/ give you an error and, I suspect, several attempts
at rebuilding the entire Solution will /probably/ make the problem go
away.

But then so would rewriting the above to use the String class methods,
as in :

If TextBox1.Text.StartWith( "$" ) Then
TextBox1.Text = TextBox1.Text.Substring( 1 )
' OK; it /doesn't/ allow for when the text is /only/ "$" ...
End If

HTH,
Phill W.
Nov 21 '05 #3
"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...

"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl... .. . .
Adding: Imports Microsoft.VisualBasic
And removing the "Microsoft.VisualBasic" from the Left and Right
functions gives me a compile error.

Never mind. I just read where these functions must be fully qualified...


/Where/ did you read that? Just curious ...

Regards,
Phill W.
Nov 21 '05 #4

"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> wrote in message
news:cu**********@yarrow.open.ac.uk...
"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...

"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...

. . .
Adding: Imports Microsoft.VisualBasic
And removing the "Microsoft.VisualBasic" from the Left and Right
functions gives me a compile error.

Never mind. I just read where these functions must be fully qualified...


/Where/ did you read that? Just curious ...

Regards,
Phill W.


Here is where I found it:

ms-help://MS.VSCC/MS.MSDNVS/vblr7/html/vafctLeft.htm

Thanks..

Bruce

Nov 21 '05 #5
Bruce,

You should have a reference to your Microsoft.VisualBasic namespace which is
when you use VSNet with VBNet as with the import standard set. (See your
project properties for that).
You can than do Right(whatever)

By the way the full path to the right function is
Microsoft.VisualBasic.Strings.Right

Although I prefer the simple
If textbox1.text.substring(0,1) = "$"

I hope this gives some idea's

Cor
Nov 21 '05 #6

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uk**************@TK2MSFTNGP09.phx.gbl...
Bruce,

You should have a reference to your Microsoft.VisualBasic namespace which is when you use VSNet with VBNet as with the import standard set. (See your
project properties for that).
You can than do Right(whatever)

By the way the full path to the right function is
Microsoft.VisualBasic.Strings.Right

Although I prefer the simple
If textbox1.text.substring(0,1) = "$"

I hope this gives some idea's

Cor


Cor:

By "reference to your Microsoft.VisualBasic namespace ", do you mean that I
should have the following:

Imports Microsoft.VisualBasic
..
Then the following should work? It doesn't. I get a compile error when the
web page is compiled

If (Left(TextBox1.Text, 1) = "$") Then

TextBox1.Text = Right(TextBox1.Text, TextBox1.Text.Length - 1)

End If

If this is not what you mean, then I don't understand your reply.

Thanks.

Bruce
Adding:

Nov 21 '05 #7
Bruce,

Normally (I saw now that you are using Visual Studio Net or Visual Studio
Basic), there should be a automaticly reference when you have created a form
project using new project.

That you can see in the solution explorer which is usual a right side. In
that is a (directory) tab References, when you open that you should see all
your refences and in that "Microsoft.VisualBasic". When not, than you can
set it by rightclicking on the tab and do add reference. A terrible box
shows up, however there you will find, select and add it using the Net
references.

Not direct related to that however to avoid that you have to set that long
path before the Right are the imports, that you can set in top of every
program, but also in your project properties (right clicking in that same
solution explorer on the project and than properties). In that is a section
Imports.

There are all the standard imports placed.

I hope this tells it, otherwise feel free to reply again.

Cor
Nov 21 '05 #8
"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> schrieb:
> Adding: Imports Microsoft.VisualBasic
> And removing the "Microsoft.VisualBasic" from the Left and Right
> functions gives me a compile error.

Never mind. I just read where these functions must be fully qualified...


/Where/ did you read that? Just curious ...


There can be a name clash with a form's 'Left' property, for example.
Nevertheless, you don't need to fully qualify the function name. Specifying
the name of the module containing the 'Left' method ('Strings.Left') is
sufficient in most cases.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #9
Bruce,
And removing the "Microsoft.VisualBasic" from the Left and Right functions
gives me a compile error. Remember that a Form has a Left & Right property that hides the Left & Right
functions.

Normally what I do is use an import alias in my Forms, something like:

Imports VB = Microsoft.VisualBasic
If (VB.Left(TextBox1.Text, 1) = "$") Then

TextBox1.Text = VB.Right(TextBox1.Text,
TextBox1.Text.Length - 1)

End If
Hope this helps
Jay

"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...I have:

If (Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "$") Then

TextBox1.Text = Microsoft.VisualBasic.Right(TextBox1.Text,
TextBox1.Text.Length - 1)

End If

Adding: Imports Microsoft.VisualBasic

And removing the "Microsoft.VisualBasic" from the Left and Right functions
gives me a compile error.

Why?

Nov 21 '05 #10

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
Bruce,
And removing the "Microsoft.VisualBasic" from the Left and Right functions gives me a compile error. Remember that a Form has a Left & Right property that hides the Left &

Right functions.

Normally what I do is use an import alias in my Forms, something like:

Imports VB = Microsoft.VisualBasic
If (VB.Left(TextBox1.Text, 1) = "$") Then

TextBox1.Text = VB.Right(TextBox1.Text,
TextBox1.Text.Length - 1)

End If


Hope this helps
Jay

"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...
I have:

If (Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "$") Then

TextBox1.Text = Microsoft.VisualBasic.Right(TextBox1.Text,
TextBox1.Text.Length - 1)

End If

Adding: Imports Microsoft.VisualBasic

And removing the "Microsoft.VisualBasic" from the Left and Right functions gives me a compile error.

Why?



This is a webform (ASP.NET) that I am developing. I should have mentioned
this. With this information, I'm sure many of you will "Ah, but of course"
because the solution was

<%@ Import Namespace = "Microsoft.VisualBasic" %>

Thanks for your help...

Bruce
Nov 21 '05 #11
Bruce,

That one you would need when you are *not* using VBNet with a DLL approach.

Cor
Nov 21 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Wayne Wengert | last post: by
8 posts views Thread by A.M | last post: by
12 posts views Thread by patang | last post: by
9 posts views Thread by Wayne Wengert | last post: by
19 posts views Thread by gk245 | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.