Passing multidimensional arrays

  • Thread starter Thread starter Ian
  • Start date Start date
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
 
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
 
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
 
Back
Top