Message Boards Message Boards

Problem with System.Array in Mathematica?

Posted 8 years ago

i am using NETLink to use some COM Objects in Mathematica, it works fine with almost all the functions, except one, that function has the following sintax in VB:

Compute_CurrentPlan(nmsg As Long, msg() As String) As Boolean

So i was reading about this problem in other languages and i found that the function has also the next sintax:

Compute_CurrentPlan(ByRef nmsg As Integer, ByRef msg As System.Array) As Boolean

And i found than a solution to this problem was declare msg as New Array , so i follow this solution and use CreateInstance in Mathematica:

x = NETNew["System.Array[]", 10000];

z = NETNew["System.String", 72];

y = l@CreateInstance[z@GetType[], {10000}, {1}];

ras@Compute?CurrentPlan[0, y]

But it doesn´t work, i get this message:

A .NET exception occurred: \ "System.Reflection.TargetInvocationException: Se produjo una \ excepción en el destino de la invocación. ---> \ System.IndexOutOfRangeException: Subscript out of range 

I will apreciate any help

POSTED BY: Freddy Duarte
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract