Example Code

Change Label Text of Control in Another VI

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

Download All
Overview

This example demonstrates how to change the label of a control/indicator in another VI programmatically.

 

Description

To change the label, you need to open a reference to the VI with the control you would like to change the label of. You can then get a reference to the front panel. From the front panel you can get an array of references to the controls. Index the array to the desired control and use a property node to set the label text.

 

Requirements

 Software

  • LabVIEW Base Development System 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached ZIP-file
  2. Open the Simple VI and the Change Label Text VI
  3. Run the Change Label Text VI

 

Additional Information or References

Change Label Text - Front Panel.png

Change Label Text - Block Diagram.png

 

Note: The VI that contains the control you want to change the label of cannot be running. Changing the label is editing the VI and cannot be done while it is running.

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**

Bryan H.

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

Comments
Member
Member
on

Hello Hesloppy,

Why are you changing the Label?  As you pointed out the cannot be changed at runtime. The Caption can be changed at runtime.

Thanks,

Gary

NI Employee
on

Hi Gary,

I am not sure of the use case for it.  I talked to someone who wanted to be able to change the label so I put together an example.

Best regards,

Bryan

Bryan H.
Active Participant
Active Participant
on

Scripting ishaving LabVIEW write LabVIEW code for you, so you might want to open a template of a VI, replace a control with a new one, and then change the label - which can all be done automatically by LabVIEW

Ryan Vallieu
Senior Systems Analyst II
NASA Ames Research Center
Member
Member
on

how can change the language of labels from English to other. Is it possible using labview?

Member
Member
on

Hello Srikant,

The Labels of Controls and Indicators cannot be changed at run time. You

could however

change the Caption text of the Controls and Indicators. Instead of

displaying the Label

text display the Caption text. Then you can change the language of the

text in the Caption

at run time.

You could also change text of Ring Controls but not ENUM Controls.

I hope this helps.

Gary