LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

use .NET C# DLL ref string into LabView 7

I try to use a class from C#

Everything is going fine,
First : I create the constructor Node
Second : I try with an easy method : int ReturnInt(); //everything is fine

Then : I try with this function : public void GetScpiVersion(ref string aData)

I don't know how to use the property into the invoke node


please look at the Attachment


thanks

Phil
0 Kudos
Message 1 of 5
(3,514 Views)
First let me congratulate you - that is one of the best screenshots I've ever seen on this forum!

The problem you are running into is that the 7.x version of LV does not handle ref parameters automatically. However, you can use a couple of handy VI's in vi.lib to convert a LV string into a .NET object and pass that in. On the way out, convert the output from .NET to a LV Variant, and then back to a string. A bit of the pain, I know, but we are fixing it.

See the following for more information: http://detritus.blogs.com/lycangeek/2005/05/some_handy_vis.html
Message 2 of 5
(3,507 Views)
Thanks ! I have a similar VI. I have .NET dll in c# which takes in references to 2D arrays. I was confused but after reading this post, I know what to do. Hats off to you for being so active !! Thanks again

Kudos are the best way to say thanks 🙂
0 Kudos
Message 3 of 5
(3,430 Views)
Can you please have a look at the attached JPG ? I am missing something. The VI in vi.lib converts the array to an .NET object and the .NET dll accepts a .NET int32 array. So is there something that needs to go in between ?

Kudos are the best way to say thanks 🙂
0 Kudos
Message 4 of 5
(3,429 Views)
You need to covert your output of To Object. When that VI runs, what comes out is a .NET array, but as far as both LV and your assembly is concerned, it is only a .NET object. So use the cast nodes in the .NET palette to let everyone know that it's really a .NET array.
0 Kudos
Message 5 of 5
(3,396 Views)