problem with join()

A

André

Hi,

I have a two-dimension array with integers and i want to join it into a
string. See my code:
dim va(10,5) as integer
dim mystring as string
....
for j=1 to 10
for k=1 to 5
mystring = Join(";",va(j,k).ToString)
next
next


The error i get is: "value of type string cannot be converted to
1-dimensional array of string"

Thanks for help
André
 
T

Tom Shelton

André said:
Hi,

I have a two-dimension array with integers and i want to join it into a
string. See my code:
dim va(10,5) as integer
dim mystring as string
...
for j=1 to 10
for k=1 to 5
mystring = Join(";",va(j,k).ToString)
next
next


The error i get is: "value of type string cannot be converted to
1-dimensional array of string"

Thanks for help
André

well, thakes a string and a 1-dimensional array. By calling .ToString
you calling it with a string and a string - not an array. Hence your
error.

Of course, you can't call it with a 2D array anyway. So, your probably
going to have to do this manually. I would look at using
System.Text.StringBuilder to build your string.
 
A

André

Thanks

"Tom Shelton" <[email protected]> schreef in bericht

André said:
Hi,

I have a two-dimension array with integers and i want to join it into a
string. See my code:
dim va(10,5) as integer
dim mystring as string
...
for j=1 to 10
for k=1 to 5
mystring = Join(";",va(j,k).ToString)
next
next


The error i get is: "value of type string cannot be converted to
1-dimensional array of string"

Thanks for help
André

well, thakes a string and a 1-dimensional array. By calling .ToString
you calling it with a string and a string - not an array. Hence your
error.

Of course, you can't call it with a 2D array anyway. So, your probably
going to have to do this manually. I would look at using
System.Text.StringBuilder to build your string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top