473,388 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 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 5085

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Wayne Wengert | last post by:
I use statements like LEFT(textstring,6) in my app. I have "Imports Microsoft.VisualBasic" at the top of the code but to use LEFT I have to code : Microsoft.VisualBasic.Left(sting, integer) If...
8
by: A.M | last post by:
Hi, Using C#, what is the equivalent of functions Left, Right and Mid that we had in vb6? Thanks, Alan
12
by: patang | last post by:
This is really silly question. Dim s As String s = "the" s = Right(s, 2) Why this gives me compilation error? (This works in VB6 .. what do I have to do to make it work in VB.Net) I have...
9
by: Wayne Wengert | last post by:
In VB6 I used to use the Left and Right functions a lot. e.g. strString = Left(txtTexbox1.Text, 20). In VB.NET I know I can prefix those functions with Microsoft.VisualBasic.Left but I suspect...
19
by: gk245 | last post by:
I have something like this: printf("Enter numbers: "); scanf ("%i", &number); If the user put in a bunch of numbers (like 4568), instead of just one number, i know that you can extract the...
4
by: UJ | last post by:
I have a long list of items that the user will be able to select from. When they select an item, I'd like to have more detailed information appear on the right side of the screen. I've already got...
9
by: sql guy123 | last post by:
I normally use MS ACCESS vs MS SQL,, which has a left() and right() function. I need to use MS SQL for this project but I am not familiar with it. I have read a few books, but can not figure out...
5
by: Timeri | last post by:
This is a bit confusing until you actually see what I'm talking about but the main content of my page is not growing with the right column. I want the main content (left/larger column) to take into...
32
by: Greg | last post by:
I know I can use the Microsoft.VisualBasic.Left function to get the left portion of a string, but I would prefer to avoid using any Microsoft.VisualBasic namespace items. What is the equivilant in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.