VB6 Handling a string array returned from a COM object

I have the unsavory task of making a change to an old VB6 application.
The application needs to receive an array of errro messages from a COM object written in .NET.

I have been struggling with the code to get the individual array entries in printable form in VB6 with code similar to

dim o as object
set o = createobject("dotnet.app")
dim test as object
obj = o.errormessages

print obj(0)
print obj(1)

it's been a while and my VB6 skills are rusty.

Thanks in advance

Charles SugdenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
I have never worked with .net objects in VB6, so I would have to test this out.
what does
print typename(obj) return?
what error message(s) do you get?
Charles SugdenAuthor Commented:
Sorry to respond so late. I was off on Fridat.
The return type was defintiely as string()

My latest attempt was
dim o as object
set o = createobject("dotnet.app")
dim test as variant
dim ar() as string
test = o.errormessages

Still can seem to get the array elements displayed.
I get subscript out of bounds
Guy Hengel [angelIII / a3]Billing EngineerCommented:
can you please post
print lbound(test)
print ubound(test)
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Charles SugdenAuthor Commented:
I get Subscript out of Range.

The tech jerk that i work for refuses to show me the code he wrote in the DLL.

I used isempty(test) and it returns false wehich leads me to believe that there is content in there but yet the string() property cannot be subscripted...
Guy Hengel [angelIII / a3]Billing EngineerCommented:
reading this, the array() from .net is rather a collection, not a vb6 array:
dim o as object
set o = createobject("dotnet.app")
dim test as variant
for each test in  o.errormessages
   print test

Open in new window

Charles SugdenAuthor Commented:
Wow that sounds like the solution however I am getting an error message
"For Loop Not Initialized"

FYI: A test on o.errormessages using isempty was false
Guy Hengel [angelIII / a3]Billing EngineerCommented:
then you have to get your "jerk" to give the specs ...
it's maybe some special collection, which doesn't implement the same interface(s).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.