Example Program Drafts

Showing results for 
Search instead for 
Did you mean: 

Calling a Struct Datatype on a .NET C# DLL within LabVIEW

by Member Efrain_G ‎05-11-2011 06:36 PM - edited ‎01-30-2017 09:47 AM


These example shows how to access a struct datatype that has been created on .NET C# within LabVIEW.


1) Open New project on Visual Studio

2) Choose Visual c#>>Class Library

3) Drop in this example code:

namespace clusterPassing


  public struct myStruct             //Here you define a structure within "ClusterParsing"


            public string myStr;

            public int myInt;


    public class myClass            //Here a class is created within "ClusterParsing"


        public int myMethod(myStruct data1)    //Here a method for this class is defined


            return data1.myInt;




4) Select Build>>Solution (This will build a .NET assembly with the dll)

5) Open LabVIEW and drop a .NET constructor Node in the block diagram

6) Double click on the Constructor Node and it will bring a list of all the registered dlls on your machine. This registry is called the GAC(Global Assembly Cash).   

7) Select the desired dll from the GAC. If you do not have a Microsoft certified dll you will have to browse to find it. This will happen if the dll was created by you.

8) Now use Invoke Nodes to access Actions or Methods and Property nodes to access properties and variables from the classes found on this dll.

Additional Notes:

The LabVIEW example attached is not ready to be run, it is just meant to show how to access properties and methods of the class included on the respective dll.