Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18011
Number of posts: 55384

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
String Array Posted by tcf4 on 31 Aug 2005 at 7:54 AM
I have an array declared as Public Line(100) As String but when I try to use it later, line(channel) = "F", it gives me a compile error. Am I missing something?
Report
Re: String Array Posted by BitByBit_Thor on 31 Aug 2005 at 8:11 AM
: I have an array declared as Public Line(100) As String but when I try to use it later, line(channel) = "F", it gives me a compile error. Am I missing something?
:

What's channel?

Anyway, declaring Line(100) declares 101 entries, ranging from 0 to 100.

Greets...
Richard

Report
Re: String Array Posted by tcf4 on 31 Aug 2005 at 8:29 AM
: : I have an array declared as Public Line(100) As String but when I try to use it later, line(channel) = "F", it gives me a compile error. Am I missing something?
: :
:
: What's channel?
:
: Anyway, declaring Line(100) declares 101 entries, ranging from 0 to 100.
:
: Greets...
: Richard
:
:
channel is an integer that goes from 1 to 100
Report
Re: String Array Posted by BitByBit_Thor on 31 Aug 2005 at 8:45 AM
: : : I have an array declared as Public Line(100) As String but when I try to use it later, line(channel) = "F", it gives me a compile error. Am I missing something?
: : :
: :
: : What's channel?
: :
: : Anyway, declaring Line(100) declares 101 entries, ranging from 0 to 100.
: :
: : Greets...
: : Richard
: :
: :
: channel is an integer that goes from 1 to 100
:

Post the piece of code which gives the compile error please.

Greets...
Richard

Report
Re: String Array Posted by tcf4 on 31 Aug 2005 at 9:08 AM
: : : : I have an array declared as Public Line(100) As String but when I try to use it later, line(channel) = "F", it gives me a compile error. Am I missing something?
: : : :
: : :
: : : What's channel?
: : :
: : : Anyway, declaring Line(100) declares 101 entries, ranging from 0 to 100.
: : :
: : : Greets...
: : : Richard
: : :
: : :
: : channel is an integer that goes from 1 to 100
: :
:
: Post the piece of code which gives the compile error please.
:
: Greets...
: Richard
:
:

Line(channel) = "F"

It's the error it's giving me is Expected: List separator
Report
Re: String Array Posted by BitByBit_Thor on 31 Aug 2005 at 9:23 AM
Post the code around that one line.

Anyway, are you sure the "'s are indeed "'s? Perhaps one of them is ''?

Greets...
Richard

Report
Re: String Array Posted by tcf4 on 31 Aug 2005 at 9:29 AM
: Post the code around that one line.
:
: Anyway, are you sure the "'s are indeed "'s? Perhaps one of them is ''?
:
: Greets...
: Richard
:
:
If ResistanceFail(channel) >= ResistorFail Then
Failed(channel) = 1
Line(channel) = "F"
End If

I checked and they are double quotes.
Report
Re: String Array Posted by infidel on 31 Aug 2005 at 9:43 AM
:         If ResistanceFail(channel) >= ResistorFail Then
:             Failed(channel) = 1
:             Line(channel) = "F"
:         End If


"Line" is the name of a type of control. My guess is the compiler is confused as to whether you are referring to your array or the built-in type.


infidel

$ select * from users where clue > 0
no rows returned


Report
Re: String Array Posted by BitByBit_Thor on 31 Aug 2005 at 10:03 AM

: "Line" is the name of a type of control. My guess is the compiler is confused as to whether you are referring to your array or the built-in type.
:
:

Damn :-S I think you are probably right about that :-S. It's always annoying to see the limitations of VB...

I'd advise you change the name. I know of no other way...
(Line is also a function of a Form)

Greets...
Richard

Report
Re: String Array Posted by tcf4 on 31 Aug 2005 at 12:23 PM
:
: : "Line" is the name of a type of control. My guess is the compiler is confused as to whether you are referring to your array or the built-in type.
: :
: :
:
: Damn :-S I think you are probably right about that :-S. It's always annoying to see the limitations of VB...
:
: I'd advise you change the name. I know of no other way...
: (Line is also a function of a Form)
:
: Greets...
: Richard
:
:
Ah. Problem fixed. Thanks
Report
Re: String Array Posted by infidel on 31 Aug 2005 at 3:14 PM
This message was edited by infidel at 2005-8-31 15:16:28

: :
: : : "Line" is the name of a type of control. My guess is the compiler is confused as to whether you are referring to your array or the built-in type.
: : :
: : :
: :
: : Damn :-S I think you are probably right about that :-S. It's always annoying to see the limitations of VB...
: :
: : I'd advise you change the name. I know of no other way...
: : (Line is also a function of a Form)

It was probably the Line method of the form that was causing the naming conflict rather than the Line control. I've seen too many coders I work with who declare variables with the same name as the class of object they are instantiating like this:

Dim clsFoobar As clsFoobar

VB actually allows this idiocy.


infidel

$ select * from users where clue > 0
no rows returned







 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.