Creating .NET Objects on the Block Diagram

LabVIEW 2018 Help

Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)

LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help
LabVIEW 2020 Help

You can use LabVIEW to access objects associated with third party .NET servers. You can create either visible or invisible .NET objects on the block diagram and set properties, methods, or handle events for the objects. For example, you can place a .NET container on the block diagram and then place a button within the container that accesses a third party browser. 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 the Select .NET 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 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 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 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, Invoke Node, or Register Event Callback and set properties, set methods, or 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

  • .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


Not Helpful