I have a VB6 code that cannot be easily changed, which looks like this:
Dim cCount as Long Dim rCount as Long Dim result() Set mx = CreateObject("Component.Class") Dim rtn = mx.GetList(rCount,cCount,result)
The method that it calls is currently a component of VB6, which we ported to .NET with one problem. We do not know what type the result () is looking for, since it is the type of the variant. We tried an object, an object [], an object [] [], a string, a string [], etc., None of which worked.
Here is an example:
public bool GetList(ref long rCount, ref long cCount, ref object result) { ... }
I even tried setting the third parameter to VariantWrapper, as it will add ByRef as needed:
public bool GetList(ref long rCount, ref long cCount, VariantWrapper result) { ... }
Any ideas what I can set for the incoming result so that I don't have an unhandled exception?
I created a test interface (for COM), a test class, and a VB6 test application to make sure this is a problem with the option. So, it is defined as follows:
.NET Interface:
[DispId(1)] [ComVisible(true)] string Test(ref object[] value);
Method VB 6:
Private Sub Command1_Click() Set mx = CreateObject("Component.Class") Dim result() MsgBox mx.Test(result) End Sub
Same problem as described above. In VB6, it just kicks me out. If I compile and run it, I get a generic .NET exception, and it throws me out.