Passing arrays

  • Thread starter Thread starter Mike Fellows
  • Start date Start date
M

Mike Fellows

i have a function that returns an array

i have 6 items of data in the datagrid and i am setting them like this

MyArray.SetValue(1,0)

so im placing 1 in position 0 of my array

when i return my array using

return MyArray


when i call my function i use

dim MyNewArray as array
MyNewArray = myfunction(a,b,c,d)

when i do this, i get the error: Object reference not set to an instance of
an object.

is there a way i need to specifically pass arrays?

anyhelp would be appreciated


Mike
 
HI ,

If your my function is like this

Private Function retAr() As Array
Dim x As Integer() = {1, 2, 3}


Return x

End Function


and you call it as follows

Dim MyNewArray as Array

mynewarray = retAr()


and then call

mynewArray.getvalue(0), it should return 1.


If you still have problems, could you send the code for the function that
returns an array.

Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks
 
Back
Top