S
Sam
Hello All,
I have this VB 6 code :
'******************************************************************
' Purpose :
' Initialize an array with available metric for the selected
component
'
' Parameters :
' lArray : array to fill
'
'******************************************************************
Public Sub AvailableMetrics(lArray() As Long)
Dim i As Integer
' uUnitArray exists
ReDim lArray(0 To UBound(uUnitArray))
For i = 0 To UBound(uUnitArray)
lArray(i) = uUnitArray(i).MetricId
Next i
End Sub
I'd want to perform an IDispatch call (late binding) to pass by
reference an array, but i get a Type mismatch exception with the
following C# code :
public static object CallMethodArray(object instance, string
methodName, object[] parameters)
{
try
{
ParameterModifier[] mods = new ParameterModifier[1] {
new ParameterModifier(1) };
mods[0][0] = true;
return instance.GetType().InvokeMember(methodName,
memberAccess | BindingFlags.InvokeMethod, null, instance,
parameters,mods,null,null);
}
catch (TargetInvocationException e)
{
if (e.InnerException != null)
log.Debug("Call Invocation failed :" +
e.InnerException.Message);
throw e;
}
}
Any idea?
thanx
Sami
I have this VB 6 code :
'******************************************************************
' Purpose :
' Initialize an array with available metric for the selected
component
'
' Parameters :
' lArray : array to fill
'
'******************************************************************
Public Sub AvailableMetrics(lArray() As Long)
Dim i As Integer
' uUnitArray exists
ReDim lArray(0 To UBound(uUnitArray))
For i = 0 To UBound(uUnitArray)
lArray(i) = uUnitArray(i).MetricId
Next i
End Sub
I'd want to perform an IDispatch call (late binding) to pass by
reference an array, but i get a Type mismatch exception with the
following C# code :
public static object CallMethodArray(object instance, string
methodName, object[] parameters)
{
try
{
ParameterModifier[] mods = new ParameterModifier[1] {
new ParameterModifier(1) };
mods[0][0] = true;
return instance.GetType().InvokeMember(methodName,
memberAccess | BindingFlags.InvokeMethod, null, instance,
parameters,mods,null,null);
}
catch (TargetInvocationException e)
{
if (e.InnerException != null)
log.Debug("Call Invocation failed :" +
e.InnerException.Message);
throw e;
}
}
Any idea?
thanx
Sami