safearrays

hi,
I developed a component in ATL which has a method which accepts no in-parameters but gives an out-parameter as an array.I have used a safearray as an out parameter,but in my client(in vb) i give a variant array to be filled up,this gives an error.I'll give the code also

dim obj as mylib.mycomponent
dim arr()as variant
set obj = createobject("progid")
call obj.mymethod(arr())
        Error occurs in the above statment
how will i solve this problem????
rvsamuelAsked:
Who is Participating?
 
MirkwoodConnect With a Mentor Commented:
A variant can be a safearray. So most likely you change the code to the following.

dim obj as mylib.mycomponent
dim arr as variant
set obj = createobject("progid")
call obj.mymethod(arr)

0
 
rvsamuelAuthor Commented:
i tried ur code,the problem i face is,the array's second element returns the ubound of the array and the remaining elements return no value,so i cannot solve this problem.
0
All Courses

From novice to tech pro — start learning today.