String to array of string array

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

    String to array of string array

    Hi

    How can I cast a string variable to a one element string array of one
    dimension? I need this to pass a string value to a sub that accepts an array
    of string as parameter.

    Thanks

    Regards


  • Steve Gerrard

    #2
    Re: String to array of string array

    John wrote:
    Hi
    >
    How can I cast a string variable to a one element string array of one
    dimension? I need this to pass a string value to a sub that accepts
    an array of string as parameter.
    >
    Thanks
    >
    Regards
    Dim S As String = "test"

    SomeSub(New String() {S})


    Comment

    • Cor Ligthert[MVP]

      #3
      Re: String to array of string array

      John,

      You cannot cast a string to an array of strings, you even cannot convert it,
      the only thing you can do is set a string in a string array.

      While as that is a one elemenet string array then it is.

      TheArray(0) = TheString

      Cor

      "John" <info@nospam.in fovis.co.ukschr eef in bericht
      news:%23fyQHcSx IHA.1936@TK2MSF TNGP04.phx.gbl. ..
      Hi
      >
      How can I cast a string variable to a one element string array of one
      dimension? I need this to pass a string value to a sub that accepts an
      array of string as parameter.
      >
      Thanks
      >
      Regards
      >
      >

      Comment

      Working...