473,378 Members | 1,067 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,378 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 8361
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...

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.