what is the most efficient way to convert an array into string

       Dim intArr() = {1, 2, 3}

        MsgBox(Convert.ToString(intArr)) does not work
        MsgBox(Convert.ToString(CObj(intArr))) either

Who is Participating?
You know, if your array is of the Type Integer, then you may need to take this kind of an approach:

    'This sub is not required, but put the code in whatever sub you want to show the message in.
    Private Sub ShowArray()
        Dim intArr() As Integer = {1, 2, 3}
        Dim str As String() = Array.ConvertAll(Of Integer, String)(intArr, AddressOf IntToString)

        MsgBox(Join(str, ","))

    End Sub

    'This sub is required
    Private Shared Function IntToString(ByVal i As Integer) As String

        Return CType(i, String)

    End Function

DarrenSenior Software EngineerCommented:
If you have three array items thn you have to output them as follows


Or if you want to convert the array to 'String' type

This might work

Dim arrStr() as string = CType(intArr, String)
You can just use the Join method:

    MsgBox(Join(intArr, ","))

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.