By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

really strange error

P: n/a
Greetings all,

I've been working and reworking some legacy vb.net 1.1 code for a
couple of months now and have just encountered an un-googleable error:

Expression is not an array or a method, and cannot have an argument
list.

This is happening for the Mid fct call in the following block of code:

dim tStr,uStr as string
tStr = "abc def ghi"
uStr = Mid( tStr, 1, 1 )

Now, this code is contained within a case block of a select case
statement.

The imports for the file are:

imports System
imports System.Data
imports System.Data.SqlClient
imports System.Text
imports Microsoft.Office.Interop

The file is parsing an Excel spreadsheet.

Other files in my project use the Mid fct without issue, and if I
prefix Mid with "Microsoft.VisualBasic.", everything is ok.

Anyone have any clues? I'm thoroughly stumped.

Thanks in advance,
Robert McCall

Apr 4 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Well, that was quick: I had a class member variable named mId (one of
my favorites), and the case-insensitivity of VB got me. C# is much
more to my liking, but, excuses aside, sorry for the bandwidth.

Apr 4 '06 #2

P: n/a
hi Robert,

how about:

uStr = Microsoft.VisualBasic.Mid(tStr, 1, 1)

?

-t

robertmccall ha scritto:
Greetings all,

I've been working and reworking some legacy vb.net 1.1 code for a
couple of months now and have just encountered an un-googleable error:

Expression is not an array or a method, and cannot have an argument
list.

This is happening for the Mid fct call in the following block of code:

dim tStr,uStr as string
tStr = "abc def ghi"
uStr = Mid( tStr, 1, 1 )

Now, this code is contained within a case block of a select case
statement.

The imports for the file are:

imports System
imports System.Data
imports System.Data.SqlClient
imports System.Text
imports Microsoft.Office.Interop

The file is parsing an Excel spreadsheet.

Other files in my project use the Mid fct without issue, and if I
prefix Mid with "Microsoft.VisualBasic.", everything is ok.

Anyone have any clues? I'm thoroughly stumped.

Thanks in advance,
Robert McCall


Apr 4 '06 #3

P: n/a
"robertmccall" <rm*****@cbplan.com> schrieb:
I've been working and reworking some legacy vb.net 1.1 code for a
couple of months now and have just encountered an un-googleable error:

Expression is not an array or a method, and cannot have an argument
list.

This is happening for the Mid fct call in the following block of code:

dim tStr,uStr as string
tStr = "abc def ghi"
uStr = Mid( tStr, 1, 1 )

Now, this code is contained within a case block of a select case
statement.

The imports for the file are:

imports System
imports System.Data
imports System.Data.SqlClient
imports System.Text
imports Microsoft.Office.Interop

The file is parsing an Excel spreadsheet.

Other files in my project use the Mid fct without issue, and if I
prefix Mid with "Microsoft.VisualBasic.", everything is ok.


Right-click 'Mid' and choose "Go to Definition". Which type is shown? If
it's not 'Microsoft.VisualBasic.Strings', then a type clash exists and you
need to qualify 'Mid' either using 'Microsoft.VisualBasic.Strings' or
'Microsoft.VisualBasic'.

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

Apr 4 '06 #4

P: n/a
I you are going to use Visual Basic functions a lot like Mid, left, etc, then
as easy way to do it is to add an imports statement with an alias;

Imports VB = Microsoft.VisualBasic

then, use VB.Mid(.... or VB.Left(....
--
Dennis in Houston
"robertmccall" wrote:
Well, that was quick: I had a class member variable named mId (one of
my favorites), and the case-insensitivity of VB got me. C# is much
more to my liking, but, excuses aside, sorry for the bandwidth.

Apr 4 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.