473,413 Members | 1,799 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,413 software developers and data experts.

Problem with LEFT

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 I code just "Left" it is flagged as an error with the message

"Public Overloads Property Left() As Integer has no parameters and its
return type cannot be indexed"

How can I get the VisualBasic version of Left as the default?
--
------------------------------------
Wayne Wengert
wa***@wengert.org
Jul 19 '05 #1
7 8374
Did you use Left as a variable or function name?
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
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 I code just "Left" it is flagged as an error with the message

"Public Overloads Property Left() As Integer has no parameters and its
return type cannot be indexed"

How can I get the VisualBasic version of Left as the default?
--
------------------------------------
Wayne Wengert
wa***@wengert.org

Jul 19 '05 #2
Are there other namespaces that implement a "Left". The form in question has
the following namespaces

Imports Microsoft.VisualBasic

Imports System.IO

Imports System.Char ' Allows use of ControlChars.nnnn

Imports System.Data.OleDb

Wayne

"dfsdf" <sd****@sdfsdff.dfs> wrote in message
news:Ob********************@rwcrnsc51.ops.asp.att. net...
Did you use Left as a variable or function name?
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
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 I code just "Left" it is flagged as an error with the message

"Public Overloads Property Left() As Integer has no parameters and its
return type cannot be indexed"

How can I get the VisualBasic version of Left as the default?
--
------------------------------------
Wayne Wengert
wa***@wengert.org


Jul 19 '05 #3
You don't have to manually import the Microsoft.VisualBasic namespace --
Visual Studio does that implicitly for VB projects. You should be able to
use "Left" (and other VB keywords) automatically, without the Imports...
statement and without using the fully-qualified name.

Your problem looks like a namespace conflict. Try right-clicking on the
Left keyword in the module, and select "Go to definition" -- it'll bring up
the object browser, and highlight the method it's trying to use (the other
Left.)

Just to play Devil's advocate, have you considered using the .Net framework
equivalents for Left and other VB keywords? For example, you could replace
"x = Left(MyString, 5)" with x = MyString.Substring(0, 5). There's nothing
wrong with using the VB functions, but in my opinion it's generally a better
practice to use the .Net equivalents when possible.

Check out these links:

http://msdn.microsoft.com/library/de...et0_update.asp

http://msdn.microsoft.com/vbasic/usi...tinternals.asp

Hope this helps,
Robert Jacobson
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
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 I code just "Left" it is flagged as an error with the message

"Public Overloads Property Left() As Integer has no parameters and its
return type cannot be indexed"

How can I get the VisualBasic version of Left as the default?
--
------------------------------------
Wayne Wengert
wa***@wengert.org

Jul 19 '05 #4
Hmmm.. that gets me....

<System.ComponentModel.BrowsableAttribute(False) ,
System.ComponentModel.DesignerSerializationVisibil ityAttribute(0),
System.Windows.Forms.SRCategoryAttribute("CatLayou t"),
System.Windows.Forms.SRDescriptionAttribute("Contr olLeftDescr"),
System.ComponentModel.EditorBrowsableAttribute(0)>

Public Property Left As Integer

Member of System.Windows.Forms.Control

I don't see how to find what control has a "Left" property. I'll check out
the links you provided.

Wayne
"Robert Jacobson" <rj**********************@nospam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
You don't have to manually import the Microsoft.VisualBasic namespace --
Visual Studio does that implicitly for VB projects. You should be able to
use "Left" (and other VB keywords) automatically, without the Imports...
statement and without using the fully-qualified name.

Your problem looks like a namespace conflict. Try right-clicking on the
Left keyword in the module, and select "Go to definition" -- it'll bring up the object browser, and highlight the method it's trying to use (the other
Left.)

Just to play Devil's advocate, have you considered using the .Net framework equivalents for Left and other VB keywords? For example, you could replace "x = Left(MyString, 5)" with x = MyString.Substring(0, 5). There's nothing wrong with using the VB functions, but in my opinion it's generally a better practice to use the .Net equivalents when possible.

Check out these links:

http://msdn.microsoft.com/library/de...et0_update.asp
http://msdn.microsoft.com/vbasic/usi...tinternals.asp
Hope this helps,
Robert Jacobson
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
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 I code just "Left" it is flagged as an error with the message

"Public Overloads Property Left() As Integer has no parameters and its
return type cannot be indexed"

How can I get the VisualBasic version of Left as the default?
--
------------------------------------
Wayne Wengert
wa***@wengert.org


Jul 19 '05 #5
Wayne,
Remember Left & Right are a properties of System.Windows.Forms.Control,
System.Windows.Forms.Form inherits from Control.

If you want to use the VB.Left or VB.Right functions within a Form or
UserControl, you need to prefix it with a namespace.

One handy method is to use

Imports VB = Microsoft.VisualBasic

for your import, then you can use VB.Left to call the function.

Hope this helps
Jay
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
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 I code just "Left" it is flagged as an error with the message

"Public Overloads Property Left() As Integer has no parameters and its
return type cannot be indexed"

How can I get the VisualBasic version of Left as the default?
--
------------------------------------
Wayne Wengert
wa***@wengert.org

Jul 19 '05 #6
Great tip - didn't know you could do that.

Wayne

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
Wayne,
Remember Left & Right are a properties of System.Windows.Forms.Control,
System.Windows.Forms.Form inherits from Control.

If you want to use the VB.Left or VB.Right functions within a Form or
UserControl, you need to prefix it with a namespace.

One handy method is to use

Imports VB = Microsoft.VisualBasic

for your import, then you can use VB.Left to call the function.

Hope this helps
Jay
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
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 I code just "Left" it is flagged as an error with the message

"Public Overloads Property Left() As Integer has no parameters and its
return type cannot be indexed"

How can I get the VisualBasic version of Left as the default?
--
------------------------------------
Wayne Wengert
wa***@wengert.org


Jul 19 '05 #7
guy
re devils advocate - note that the VB string handling
functions are in some but not all cases faster than using
SubString - there is an MS doc that covers this but I
havent got the url to hand

hth

guy
-----Original Message-----
You don't have to manually import the Microsoft.VisualBasic namespace --Visual Studio does that implicitly for VB projects. You should be able touse "Left" (and other VB keywords) automatically, without the Imports...statement and without using the fully-qualified name.

Your problem looks like a namespace conflict. Try right- clicking on theLeft keyword in the module, and select "Go to definition" -- it'll bring upthe object browser, and highlight the method it's trying to use (the otherLeft.)

Just to play Devil's advocate, have you considered using the .Net frameworkequivalents for Left and other VB keywords? For example, you could replace"x = Left(MyString, 5)" with x = MyString.Substring(0, 5). There's nothingwrong with using the VB functions, but in my opinion it's generally a betterpractice to use the .Net equivalents when possible.

Check out these links:

http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnguinet/html/drguinet0_update.asp
http://msdn.microsoft.com/vbasic/usi...standing/defau lt.aspx?pull=/library/en-
us/dv_vstechart/html/vbtchmicrosoftvisualbasicnetinternals.
asp
Hope this helps,
Robert Jacobson
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
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 I code just "Left" it is flagged as an error with

the message
"Public Overloads Property Left() As Integer has no parameters and its return type cannot be indexed"

How can I get the VisualBasic version of Left as the default? --
------------------------------------
Wayne Wengert
wa***@wengert.org

.

Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Claire | last post by:
Hello, I am having a problem in my struts application with the checkboxes in my form. I have an array of checkboxes, some of which may be already selected when the form loads. My problem is when...
2
by: Bruce Duncan | last post by:
I'm a bit new to MySQL (know MS SQL well...and that may be the problem...getting the syntax confused) and I'm having a join problem...can anyone offer some help? Here's my problem: I have table1...
4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
6
by: B McDonald | last post by:
Hi. I am trying to straighten out some DIV issues in the rendering of my no-tables CSS website. Right now the biggest issue is trying to render 2 columns several DIVs deep in the box model for my...
9
by: Stephen Melia | last post by:
Hello, I've just done a redesign of website, and it's gone terribly wrong for Internet Explorer 6. I have a two column layout, and for some reason links in the right hand column cannot be...
1
by: books1999 | last post by:
Hi there, I have a problem with this css/div and i cannot work it out. I would like either container to be able to push the background box to grow but in Firefox it overflows. Can someone find a...
8
by: knoxautoguy | last post by:
This problem has consumed a lot of my time, and I'm aftraid someone will tell me that my whole approach to this objective is wrong; however, I would like to know if there is a way to do this. I...
0
by: sjickells | last post by:
Hi I am having a problem using asp:TextBox's in a transparent table. I have a background image on the page and a table in the middle of the page. I have set the background colour of the table...
2
by: davidson1 | last post by:
Hai friends..for menu to use in my website..i found in one website....pl look below website.... http://www.dynamicdrive.com/dynamicindex1/omnislide/index.htm i downloaded 2 files.... ...
1
pradeepjain
by: pradeepjain | last post by:
I have a 3 column layout left<->content<->right<->.I made a css and html in such a manner that when there is no left sidebar the content region starts from left side and takes whole width of left on...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.