Creating .NET Objects on the Block Diagram

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Complete the following steps to create a .NET object on the block diagram.

Note Note  Creating and communicating with .NET objects in LabVIEW requires the .NET CLR 4.0 that installs with LabVIEW. You must use a .NET 2.0 configuration file if you want to load .NET 2.0 mixed-mode assemblies. Refer to the requirements for using .NET with LabVIEW for more information about .NET restrictions in LabVIEW.

National Instruments strongly recommends that you use .NET objects only in LabVIEW projects.
  1. Add a Constructor Node to the block diagram.

    LabVIEW displays the Select .NET Constructor dialog box, which lists all public assemblies in the Global Assembly Cache (GAC). The Constructor Node is similar to the Automation Open function for ActiveX, except that a Constructor Node can specify initialization parameters for creating the object.
  2. Select an assembly from the Assembly pull-down menu. You also can click the Browse button to access private assemblies. .NET assemblies are .dll file types. After you select a private assembly, the assembly appears in the Assembly pull-down menu the next time you launch this dialog box.
Note  If you move a VI that uses a private assembly to a different folder or machine, you either must move the associated private .NET assembly files to a subdirectory that LabVIEW can search, or you must save the files in the Global Assembly Cache (GAC). If you build a VI that uses a private assembly into a shared library or stand-alone application, LabVIEW copies the associated private .NET assembly files to the data subdirectory in the same directory as the library or application.
  1. Select a class of .NET objects in the assembly from the Objects list. The constructors for that class appear in the Constructors section of the Select .NET Constructor dialog box.
  2. Select the constructor you want and click the OK button. LabVIEW displays the name of the class you selected on the Constructor Node.
  3. Wire the new reference output of the Constructor Node to a Property Node, Invoke Node, or Register Event Callback node to set properties or methods or handle events for that .NET object.
  4. Use the Close Reference function to close the reference to the .NET object.

You also can create a front panel .NET control.

Tip Tip  If you encounter problems loading a particular assembly or accessing objects in an assembly, debug the assembly call or use the .NET Assemblies in Memory dialog box to verify that the correct version of the assembly is in memory.


Not Helpful