String Array - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

String Array

tcf4tcf4 Posts: 49Member
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?

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : 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

  • tcf4tcf4 Posts: 49Member
    : : 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
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : : : 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

  • tcf4tcf4 Posts: 49Member
    : : : : 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
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    Post the code around that one line.

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

    Greets...
    Richard

  • tcf4tcf4 Posts: 49Member
    : 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.
  • infidelinfidel Posts: 2,900Member
    [code]
    : If ResistanceFail(channel) >= ResistorFail Then
    : Failed(channel) = 1
    : Line(channel) = "F"
    : End If
    [/code]

    "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.


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member

    : "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

  • tcf4tcf4 Posts: 49Member
    :
    : : "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
  • infidelinfidel Posts: 2,900Member
    [b][red]This message was edited by infidel at 2005-8-31 15:16:28[/red][/b][hr]
    : :
    : : : "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.


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]



Sign In or Register to comment.