Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Creating .NET Controls in a .NET Container

LabVIEW 8.2 Help
August 2006

NI Part Number:
371361B-01

»View Product Info
Download Help (Windows Only)

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

Note  Creating and communicating with .NET objects requires the .NET Framework 1.1 Service Pack 1 or later. National Instruments strongly recommends that you always put VIs that use .NET objects in a LabVIEW project and not leave them as stand-alone VIs.
  1. Place a .NET container on the front panel.



  2. Right-click the .NET container on the front panel.
  3. Select Insert .NET Control from the shortcut menu to display the Select .NET Control dialog box.
  4. 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 .NET container on the front panel.
  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.

Note  If you create a VI with .NET controls, consider using the user interface execution system. Generally, .NET controls must be accessed from the thread on which they were created (the user interface thread). By default, LabVIEW automatically sets any .NET controls to run in the UI thread. This can impact performance. If your VI with .NET controls seems to run slowly, try using the user interface execution system for that VI. Select File»VI Properties and select Execution from the pull-down menu to display the Execution Properties page. Then select same as caller from the Preferred Execution System list.

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


Resources

WAS THIS ARTICLE HELPFUL?

Not Helpful