Array Syntax

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

    #1

    Array Syntax

    I have an array of Object type

    I want to assign to each element of the array a 2D String array so I tried to assign like this:
    = New String(2, 2) but the compiler assumes these are constructor parameter

    How can I achieve that?

    Samuel

  • Jay B. Harlow [MVP - Outlook]

    #2
    Re: Array Syntax

    Samuel,
    Include {} on the end on the string array initialization, something like:

    Dim mess(3) as Object
    mess(0) = New String(2, 2) {}
    mess(1) = New String(2, 2) {}
    mess(2) = New String(2, 2) {}
    mess(3) = New String(2, 2) {}

    --
    Hope this helps
    Jay B. Harlow [MVP - Outlook]
    ..NET Application Architect, Enthusiast, & Evangelist
    T.S. Bradley - http://www.tsbradley.net


    "Samuel Shulman" <samuel.shulman @ntlworld.comwr ote in message
    news:ehR5EBJxGH A.4200@TK2MSFTN GP04.phx.gbl...
    I have an array of Object type

    I want to assign to each element of the array a 2D String array so I tried
    to assign like this:
    = New String(2, 2) but the compiler assumes these are constructor parameter

    How can I achieve that?

    Samuel


    Comment

    • Samuel Shulman

      #3
      Re: Array Syntax

      Thank you,

      Samuel


      "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @tsbradley.netw rote in
      message news:%23uquPHJx GHA.2352@TK2MSF TNGP06.phx.gbl. ..
      Samuel,
      Include {} on the end on the string array initialization, something like:
      >
      Dim mess(3) as Object
      mess(0) = New String(2, 2) {}
      mess(1) = New String(2, 2) {}
      mess(2) = New String(2, 2) {}
      mess(3) = New String(2, 2) {}
      >
      --
      Hope this helps
      Jay B. Harlow [MVP - Outlook]
      .NET Application Architect, Enthusiast, & Evangelist
      T.S. Bradley - http://www.tsbradley.net
      >
      >
      "Samuel Shulman" <samuel.shulman @ntlworld.comwr ote in message
      news:ehR5EBJxGH A.4200@TK2MSFTN GP04.phx.gbl...
      I have an array of Object type
      >
      I want to assign to each element of the array a 2D String array so I tried
      to assign like this:
      = New String(2, 2) but the compiler assumes these are constructor
      parameter
      >
      How can I achieve that?
      >
      Samuel
      >
      >

      Comment

      Working...