1 Dimension array problem
Im utilising a 3rd party web service. One of the functions (called PerformAction) accepts a parameter of type myObject.
Code:
Dim myObject As Object
PerformAction(myObject)
This gave me the error "Value of type 'myObject' cannot be converted to '1-dimensional array of myObject'."
So i changed the declaration to
Code:
Dim myObject(0) As Object
That resolved the problem, for testing purposes but how could i pass in other values that are not known until runtime? e.g.
Code:
Dim myObject(0) As Object
Code:
Dim myObject(1) As Object
Code:
Dim myObject(2) As Object
Code:
Dim myObject(3) As Object
Code:
Dim myObject(4) As Object
So if 5 objects are selected at runtime how could i pass those objects to fit the above scenario mainly to ensure the PerformAction performs the required actions for all the elements. Hope this makes sense?
Thanks
Re: 1 Dimension array problem
An array is one object with 1 or more elements
Code:
Dim myObject(4) as Object
Would define
myObject(0)
myObject(1)
myObject(2)
myObject(3)
myObject(4)
You can use redim to change the number of elements at runtime.
This will erase any values stored in the array. If values need to be retained then you can use the Preserve keyword
Code:
ReDim Preserve myObject(10)