If you only need to have an Enum control to switch between the tabs of a tab control, the easiest way is to make the Page Labels Display Visible.
To do it, right-click any tab and select Visible Items » Page Labels Display.
Tab control with the Page Labels Display Visible
The advantage of this method is that no extra terminals are created in the block diagram and that means less code to manage. Moreover, every time you create, rename or delete a tab, the values will be automatically updated on the Page Labels Display
Nevertheless, if you need need a programmatic approach, to set the active page of a tab control in LabVIEW, you can change the tab control to an indicator, or use a local variable or a Value Property Node for the tab control.
To use tab control as an indicator:
- Right-Click the tab control terminal on the block diagram and select Change to Indicator.
- Right-click the input of the Indicator and select Create » Constant.
Figure 2. Tab control as an indicator
When using this approach, no controls placed into the tab control's pages will be affected. Controls will still be controls and indicators will still be indicators. However, you won't be able to change tabs by clicking on them on the front panel anymore.
To use a local variable:
- On the Block Diagram, right-click your tab control and select Create » Local Variable.
- If the local variable is not already set to write access, then right-click it and select Change to Write.
- Right-click the input of the local variable and select Create » Constant.
To use a Value Property Node:
- On the Block Diagram, right-click your tab control and select Create » Property Node»Value.
- If the Property Node is not already set to write access, then right-click it and select Change to Write.
- Right-click the input of the Property Node and select Create » Constant.
Figure 3. Programmatically Set the Active Page of a Tab Control
The created enum constant will automatically populate with the names of the pages in your tab control. By selecting one of these pages to write to your local variable, you can programmatically set it to be the active page of your tab control on the Front Panel. However, if you create, rename or delete a tab, the values will not be automatically updated on the enum constants.