From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Programmatically Press a Button from a Sub VI Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

 

Overview

These two Vis demonstrate how to use the Value (Signaling) Property in LabVIEW to interact with a main VI from a sub VI's front panel. 


Description

LabVIEW allows event structures to be activated programmatically by using the Value (Signaling) Property.

If a sub VI's controls need to run code found in the event structure case of another VI's front panel object, the sub VI can alter the property by using control refnums passed from the main VI.

These two programs show a simple example of using event structures and control refnums to generate a random number when a button is pressed on either front panel.

Please see the two documents below for explanations behind the property and mechanical actions of the controls necessary for the implementation of this code.

 
Requirements

  • LabVIEW 2013 (or compatible)


Steps to Implement or Execute Code

  1. Open Main VI in the LabVIEW Project labeled Sub VI Button Press.
  2. Run the Main VI to start the program.
  3. Access the Sub VI front panel by using the button on the Main VI front panel.

 

Additional Information or References
VI Block Diagram

1.png 

References

LabVIEW Help: Controlling Front Panel Objects Programmatically from a SubVI

LabVIEW Help: Changing the Mechanical Action of a Boolean Object

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
T@nvi143
Member
Member
on

Can you convert your files in Lv11 ? As I am not able to use your example