tags:

views:

159

answers:

2

I'm trying to call this COM method:

Public Function DoSomething(ByRef StringStuff As Variant, **ByRef Out_Data As Variant**) As Boolean

Out_Data gets defined and populated in the method body as an ADODB.Recordset (2.6).

I've tried several different ways I can think of, but still can't seem to get that recordset object out, or in for that matter.

Any ideas?

Thanks...

A: 

I had a similar project quite sometime ago.

I used VB.NET because I read (MSDN?) that VB.NET has much better COM Interop capability in order to support upgrading of legacy VB6 code. If I remember well I used object where the interface specified variant. You can always make a small project in VB6 and then upgrade to VB.NET

renick
A: 

Can you call it using ref or out?

Object StringStuff = "Hello Word";
Object Out_Data = null;
DoSomething(ref StringStuff, ref Out_Data);
// or
DoSomething(out StringStuff, out Out_Data);

//I haven't use ADODB in a long while so convert this to whatever type is necessary
ADODB.Recordset ar = (ADODB.Recordset)Out_Data;
Chris Haas