Passing multidimensional arrays

I

Ian

I'm having problems passing a multidimensional array to a function. With
the below code, I'm told that a 2 dimensional array cannot be converted to a
1 dimensional array. Is there something I'm not doing correctly?


Dim myArray(2,2) as string
myFunction(myArray)

Private Function myFunction(ByRef myArray() as string)
' changes to the array done here
End Function
 
J

Jeremy Todd

Ian said:
I'm having problems passing a multidimensional array to a function. With
the below code, I'm told that a 2 dimensional array cannot be converted to a
1 dimensional array. Is there something I'm not doing correctly?

You have to let the function know to expect a multidimensional array.
Change it to something like:

Private Function myFunction(ByRef myArray(,) As String) As Boolean
' changes to the array done here
End Function

Jeremy
 
I

Ian

Thanks, that worked.

Jeremy Todd said:
to

You have to let the function know to expect a multidimensional array.
Change it to something like:

Private Function myFunction(ByRef myArray(,) As String) As Boolean
' changes to the array done here
End Function

Jeremy
 

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