Creating .NET Controls in a .NET Container

LabVIEW 2018 Help

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

DOWNLOAD (Windows Only)

LabVIEW 2015 Help
LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help

Complete the following steps to create a .NET control in a .NET container.

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 .NET container to the front panel window.

  2. Right-click the front panel window .NET container and select Insert .NET Control from the shortcut menu to display the Select .NET Control dialog box.
  3. 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 .NET control from the Controls list and click the OK button. The .NET control appears in the front panel window .NET container.
  2. On the block diagram, wire the .NET control to a Property Node, Invoke Node, or Register Event Callback node to set properties, invoke methods, or handle events for the control.

Do not use the Close Reference function to close the reference to a .NET control. By leaving the reference open, you ensure that the control displays correctly until you close the VI. LabVIEW automatically closes the reference when you close the VI. This recommendation differs from how you manage a reference to a block diagram .NET object.

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.
Note  .NET controls automatically use the user interface execution system.

You also can add .NET controls to the Controls palette for later use.


Not Helpful