PDA

Click to See Complete Forum and Search --> : InterOP call with object Array from .NET


gspandian
Mar 26th, 2009, 01:40 PM
hi all,
i have a object array declared in .net and i created a type library and referenced in VB6 prj. i cant able to access the object array returned from .NET.

my obj in .NET
class A
public age
public personname
public addresses[] address
end class

class personName
public firstname
public secondname
end class

class address
public street
public area
end class

the above class declaration done in csharp i just given sample code the addressess is object array of address which holds office address and home address

Now this object is return from .net to vb here the code below

vb
dim obj as A
set a=methodreturnResponse()

dim ageres as string = a.Age getting age
dim i as integer
for i=lbound(a.addresses) to ubound(a.addresses)
dim objadd as address
set objadd = a.addresses(i) returns empty always why?

next i

in above code the object from .net returns 2 address in address object. i am getting ubound as 2 and when i try to access the addressess obj which always return empy or nothing why

please clarify
regards
Pandi G S

gspandian
Apr 14th, 2009, 01:59 AM
Hi all
I got the solution , need to access the array object through variant
For Each variantObj In resp.addrArr
Debug.Print variantObj.Address1
next

will read the array value as above said

thanks
regards
Pandi GS