Creating.NET Objects on the Block Diagram

You can use LabVIEW to access objects associated with third party .NET servers. Complete the following steps to create and configure a .NET object on the block diagram.

Step 1: Configure the Constructor Node

Add the Constructor Node to the block diagram to launch either the Select .NET Core Constructor or the Select .NET Framework Constructor dialog box. Then select an assembly, objects, and constructors for a .NET object.

Refer to the following list for important details about configuring each component of the Select .NET Framework Constructor dialog box:

  • Assembly —This component lists all public assemblies in the Global Assembly Cache. To access private assemblies, click the Browse button. When you search private assemblies, note that .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.
  • Objects —The assembly you choose in the previous step determines the available objects classes. After you select a class of objects, the constructors for that class appear in the Constructors section of the Select .NET Framework Constructor dialog box.
  • Constructors —After you select a constructor, click the OK button. LabVIEW then displays the name of the class you selected on the Constructor Node.

Step 2: Configure Properties, Methods, or Events for the.NET Object

  1. The .NET Constructor Node creates a reference to an instance of a .NET object. Once you have that reference, you can act on the .NET object. To act on the object, wire the new reference output of the Constructor Node to a Property Node or Invoke Node and set properties or set methods for the object. With .NET Framework, you can Register Event Callback and handle events for the object.
  2. Use the Close Reference function to close the reference to the .NET object and relinquish the memory resource LabVIEW allocated to that object.

Tips and Troubleshooting Information for .NET Framework

  • .NET CLR 4.0 installs with LabVIEW. If you want to load .NET 2.0 mixed-mode assemblies, you must use a .NET 2.0 configuration file.
  • 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.

Related Information

Loading .NET 2.0, 3.0, and 3.5 Assemblies in LabVIEW

Requirements for Using .NET Assemblies in LabVIEW

Using .NET with LabVIEW

Creating Properties and Methods

Registering Handling .NET and ActiveX Events