Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
9 ratings:
 4.11 out of 5   

Programmatically Populating an Enum Control

Primary Software:
Primary Software Version: 7.0
Primary Software Fixed Version: N/A
Secondary Software: N/A


How can I programmatically populate an enum control with an array of strings?


You can use the Strings[] property of an enum control to programmatically populate it. It should be noted that since the strings in the Strings[] property are part of the data type of the enum control, they can only be changed during editing time. So, you will need to set the Strings[] property from another VI so that the VI containing the enum is not running.

The steps needed are:
  1. Open a VI Reference to the VI that contains the enum
  2. Get a Panel reference
  3. Read the Panel.Controls[] property
  4. Based on the Label.Text property search for the enum control
  5. Set the enum control's Strings[] property

The attached VIs demonstrate this technique.
Download both attached files.  Open, and note that the enum shows only a single choice, Before.  Open, and point the file control to the  Run the  The contents of the enum control in should have changed to the string array in

Related Links:

KnowledgeBase 20TEBKLJ: How Do I Programmatically Change the Entries of an Enumerated Type?


Report Date: 09/09/2004
Last Updated: 11/18/2012
Document ID: 3D8AH34P

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit