Reposting:About constant

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sruojlim

    #1

    Reposting:About constant

    Hi everyone
    I'm posting again this question as my system was down at time of the first
    posting...well something in the newsgroups was down.

    I'd like to know how i should declare a constant as an array with two
    dimension. I've tried the following but seems the syntax is somehow wrong.
    Can someone help me in doing so or any clue would be fully appreciate.

    Here is my bugged code:

    Const TableDOB(1..3,1 ..2) of String =
    (("John","76030 3"),("Paul","67 0403"),("George s","680902") )


    Many thanks to all



  • Randy Birch

    #2
    Re: Reposting:About constant

    You can't. Constants have to be, well, constant. Arrays are not constant.

    --


    Randy Birch
    MS MVP Visual Basic



    "sruojlim" <pasdespamsruoj lim@yahoo.ca> wrote in message
    news:WZcSd.2372 $uO.142961@news 20.bellglobal.c om...
    : Hi everyone
    : I'm posting again this question as my system was down at time of the first
    : posting...well something in the newsgroups was down.
    :
    : I'd like to know how i should declare a constant as an array with two
    : dimension. I've tried the following but seems the syntax is somehow
    wrong.
    : Can someone help me in doing so or any clue would be fully appreciate.
    :
    : Here is my bugged code:
    :
    : Const TableDOB(1..3,1 ..2) of String =
    : (("John","76030 3"),("Paul","67 0403"),("George s","680902") )
    :
    :
    : Many thanks to all
    :
    :
    :

    Comment

    • Dikkie Dik

      #3
      Re: Reposting:About constant

      sruojlim schreef:[color=blue]
      > Hi everyone
      > I'm posting again this question as my system was down at time of the first
      > posting...well something in the newsgroups was down.
      >
      > I'd like to know how i should declare a constant as an array with two
      > dimension. I've tried the following but seems the syntax is somehow wrong.
      > Can someone help me in doing so or any clue would be fully appreciate.
      >
      > Here is my bugged code:
      >
      > Const TableDOB(1..3,1 ..2) of String =
      > (("John","76030 3"),("Paul","67 0403"),("George s","680902") )
      >
      >
      > Many thanks to all
      >
      >
      >[/color]
      There is no such thing as a "array constant" in Visual Basic. Simply use
      a variable and use it member by member. If you really want to do it all
      in one statement you can use the Array function, like:

      Array(Array("Jo hn","760303") , Array("Paul","6 70403"),
      Array("Georges" ,"680902"))

      But it's not what I would call readable code.

      Best regards

      Comment

      • sruojlim

        #4
        Re: Reposting:About constant

        Thank you and really sorry for this galaxy like delay

        jm
        "Randy Birch" <rgb_removethis @mvps.org> a écrit dans le message de news:
        2I6dnWM3Q-ZSzYffRVn-3A@rogers.com...[color=blue]
        > You can't. Constants have to be, well, constant. Arrays are not constant.
        >
        > --
        >
        >
        > Randy Birch
        > MS MVP Visual Basic
        > http://vbnet.mvps.org/
        >
        >
        > "sruojlim" <pasdespamsruoj lim@yahoo.ca> wrote in message
        > news:WZcSd.2372 $uO.142961@news 20.bellglobal.c om...
        > : Hi everyone
        > : I'm posting again this question as my system was down at time of the
        > first
        > : posting...well something in the newsgroups was down.
        > :
        > : I'd like to know how i should declare a constant as an array with two
        > : dimension. I've tried the following but seems the syntax is somehow
        > wrong.
        > : Can someone help me in doing so or any clue would be fully appreciate.
        > :
        > : Here is my bugged code:
        > :
        > : Const TableDOB(1..3,1 ..2) of String =
        > : (("John","76030 3"),("Paul","67 0403"),("George s","680902") )
        > :
        > :
        > : Many thanks to all
        > :
        > :
        > :
        >[/color]


        Comment

        • sruojlim

          #5
          Re: Reposting:About constant

          Thank you and really sorry for this galaxy like delay

          jm
          "Randy Birch" <rgb_removethis @mvps.org> a écrit dans le message de news:
          2I6dnWM3Q-ZSzYffRVn-3A@rogers.com...[color=blue]
          > You can't. Constants have to be, well, constant. Arrays are not constant.
          >
          > --
          >
          >
          > Randy Birch
          > MS MVP Visual Basic
          > http://vbnet.mvps.org/
          >
          >
          > "sruojlim" <pasdespamsruoj lim@yahoo.ca> wrote in message
          > news:WZcSd.2372 $uO.142961@news 20.bellglobal.c om...
          > : Hi everyone
          > : I'm posting again this question as my system was down at time of the
          > first
          > : posting...well something in the newsgroups was down.
          > :
          > : I'd like to know how i should declare a constant as an array with two
          > : dimension. I've tried the following but seems the syntax is somehow
          > wrong.
          > : Can someone help me in doing so or any clue would be fully appreciate.
          > :
          > : Here is my bugged code:
          > :
          > : Const TableDOB(1..3,1 ..2) of String =
          > : (("John","76030 3"),("Paul","67 0403"),("George s","680902") )
          > :
          > :
          > : Many thanks to all
          > :
          > :
          > :
          >[/color]


          Comment

          • sruojlim

            #6
            Re: Reposting:About constant

            Thank you for answering...I know, i'm a "little" late, well maybe more like
            galaxies ago.

            jm

            "Dikkie Dik" <Abuse@SpamBust ers.com> a écrit dans le message de news:
            yFsSd.73$611.36 @newsfe01.lga.. .[color=blue]
            > sruojlim schreef:[color=green]
            >> Hi everyone
            >> I'm posting again this question as my system was down at time of the
            >> first posting...well something in the newsgroups was down.
            >>
            >> I'd like to know how i should declare a constant as an array with two
            >> dimension. I've tried the following but seems the syntax is somehow
            >> wrong.
            >> Can someone help me in doing so or any clue would be fully appreciate.
            >>
            >> Here is my bugged code:
            >>
            >> Const TableDOB(1..3,1 ..2) of String =
            >> (("John","76030 3"),("Paul","67 0403"),("George s","680902") )
            >>
            >>
            >> Many thanks to all
            >>
            >>
            >>[/color]
            > There is no such thing as a "array constant" in Visual Basic. Simply use a
            > variable and use it member by member. If you really want to do it all in
            > one statement you can use the Array function, like:
            >
            > Array(Array("Jo hn","760303") , Array("Paul","6 70403"),
            > Array("Georges" ,"680902"))
            >
            > But it's not what I would call readable code.
            >
            > Best regards[/color]


            Comment

            • sruojlim

              #7
              Re: Reposting:About constant

              Thank you for answering...I know, i'm a "little" late, well maybe more like
              galaxies ago.

              jm

              "Dikkie Dik" <Abuse@SpamBust ers.com> a écrit dans le message de news:
              yFsSd.73$611.36 @newsfe01.lga.. .[color=blue]
              > sruojlim schreef:[color=green]
              >> Hi everyone
              >> I'm posting again this question as my system was down at time of the
              >> first posting...well something in the newsgroups was down.
              >>
              >> I'd like to know how i should declare a constant as an array with two
              >> dimension. I've tried the following but seems the syntax is somehow
              >> wrong.
              >> Can someone help me in doing so or any clue would be fully appreciate.
              >>
              >> Here is my bugged code:
              >>
              >> Const TableDOB(1..3,1 ..2) of String =
              >> (("John","76030 3"),("Paul","67 0403"),("George s","680902") )
              >>
              >>
              >> Many thanks to all
              >>
              >>
              >>[/color]
              > There is no such thing as a "array constant" in Visual Basic. Simply use a
              > variable and use it member by member. If you really want to do it all in
              > one statement you can use the Array function, like:
              >
              > Array(Array("Jo hn","760303") , Array("Paul","6 70403"),
              > Array("Georges" ,"680902"))
              >
              > But it's not what I would call readable code.
              >
              > Best regards[/color]


              Comment

              Working...