Please help me with this... it's a nasty problem!
I'm converting a DLL-test tool for the company I work for, originally build in VB6, to VB.NET
In the old tool the method CallByName is used to invoke a method in the DLL:
CallByName(objDLL, strFunction, VbMethod, arrParameters)
The arrParameters can be (one or more) IN parameters, OUT parameters or IN/OUT parameters
In the old VB6 tool the arrParameters array is correctly filled with the results from the DLL method but in VB.NET it is not.
I looked it up in the MSDN documentation and noticed that CallByName (in .NET) sends the paremeters ByVal so that explains why it does not work anymore. (I presume in VB6 the parameters where send ByRef )
However, I have a problem now, because I need the parameters to be send ByRef.
I also tried the .NET method InvokeMember but this has the same problem.
I even included the parameter modifier (convinced this was the solution I needed) but no cigar... :confused:
'Set parameter modifier: handle all parameters as reference
Dim p As New ParameterModifier(parameters.Count)
For i = 0 To parameters.Count - 1
p(i) = True
Next
Dim mods() As ParameterModifier = {p}
Dim a As Object
'Call the DLL method
a = _currentApi.GetType().InvokeMember(method, BindingFlags.InvokeMethod, Nothing, _currentApi, parameters, mods, Nothing, Nothing)
Does someone know what the problem is in this case and more importantly: how to solve this?!
Thanks a lot for any help... this is a showstopper for me! :(