左边的问题 [英] Problem with LEFT

查看:82
本文介绍了左边的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用LEFT(textstring,6)之类的语句。我有Imports

Microsoft.VisualBasic在代码的顶部,但要使用LEFT我必须编码



Microsoft.VisualBasic.Left(sting,integer)


如果我只编码左它被标记为错误消息


" Public Overloads Property Left()因为Integer没有参数且其

返回类型无法编入索引


如何将默认的VisualBasic版本作为默认值?

-

------- -----------------------------

Wayne Wengert
wa *** @ wengert.org

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

推荐答案

您是否使用Left作为变量或功能名称?

" Wayne Wengert" < WA *** @ wengert.org>在消息中写道

新闻:OB ************** @ TK2MSFTNGP10.phx.gbl ...
Did you use Left as a variable or function name?
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
我使用像LEFT这样的语句(textstring,6)在我的应用程序中。我有Imports
Microsoft.VisualBasic在代码的顶部,但要使用LEFT我必须
代码:
Microsoft.VisualBasic.Left(sting,integer)

如果我只编码左和左。它被标记为错误消息

" Public Overloads Property Left()因为Integer没有参数且其
返回类型无法编入索引

如何将LeftB的VisualBasic版本作为默认版本?
-
--------------------------- ---------
Wayne Wengert
wa***@wengert.org
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



是否有其他名称空间实现了Left。有问题的表格

以下名称空间


进口Microsoft.VisualBasic


Imports System.IO


Imports System.Char''允许使用ControlChars.nnnn


Imports System.Data.OleDb


Wayne


" dfsdf" < SD **** @ sdfsdff.dfs>在消息中写道

news:Ob ******************** @ rwcrnsc51.ops.asp.att。 net ...
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...
你是否使用Left作为变量或函数名?

" Wayne Wengert" < WA *** @ wengert.org>在消息中写道
新闻:OB ************** @ TK2MSFTNGP10.phx.gbl ...
Did you use Left as a variable or function name?
"Wayne Wengert" <wa***@wengert.org> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
我使用像LEFT这样的语句(textstring,6 )在我的应用程序中。我有Imports
Microsoft.VisualBasic在代码的顶部但是要使用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


代码


Microsoft.VisualBasic.Left(sting,integer)
<如果我只编码左而编码它被标记为错误消息

" Public Overloads Property Left()因为Integer没有参数且其
返回类型无法编入索引

如何将LeftB的VisualBasic版本作为默认版本?
-
--------------------------- ---------
Wayne Wengert
wa***@wengert.org




您不必手动导入Microsoft.VisualBasic命名空间 -

Visual Studio对VB项目隐式执行此操作。你应该能够使用左和左。 (以及其他VB关键字)自动,没有Imports ...

语句而不使用完全限定名称。


您的问题看起来像命名空间冲突。尝试右键单击模块中的

Left关键字,然后选择转到定义 - 它会在对象浏览器中显示

,并突出显示它正在尝试使用的方法(另一个

剩下的。)


只是为了扮演魔鬼的拥护者,您是否考虑过使用.Net框架

等价于左派和其他VB关键词?例如,您可以替换

" x = Left(MyString,5)" x = MyString.Substring(0,5)。使用VB函数没有什么错误,但在我看来,在可能的情况下,使用.Net等效项通常会更好。




查看以下链接:

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

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


希望这会有所帮助,

Robert Jacobson

" Wayne Wengert" < WA *** @ wengert.org>在消息中写道

新闻:OB ************** @ TK2MSFTNGP10.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...
我使用像LEFT这样的语句(textstring,6)在我的应用程序中。我有Imports
Microsoft.VisualBasic在代码的顶部,但要使用LEFT我必须
代码:
Microsoft.VisualBasic.Left(sting,integer)

如果我只编码左和左。它被标记为错误消息

" Public Overloads Property Left()因为Integer没有参数且其
返回类型无法编入索引

如何将LeftB的VisualBasic版本作为默认版本?
-
--------------------------- ---------
Wayne Wengert
wa***@wengert.org
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



这篇关于左边的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆