This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Programmatically Change an Enumerated Type

Updated Aug 13, 2021

Reported In

Software

  • LabVIEW

Issue Details

  • Is possible to programmatically change the entries of an enumerated type?
  • When I try to programmatically modify an Enum, I see Error 1073 or Hex 0x431:
    • Error 1073 occurred at Property Node

Solution

An Enum can only be changed in Edit Mode. If you try to change it in runtime, you will get the error.
You can't edit an Enum in runtime. An alternative is to use VI Server; you can refer the example from the forum Programmatically Add Elements to Enum / Ring.
Another alternative is to use a text ring control instead. You can use the ring control to programmatically read and write the strings through the Strings property.


 
 

Additional Information

You cannot programmatically change the type (the strings) of an enumerated data type in runtime, just as you cannot programmatically change an integer control into a double or a string control into a path control.
The strings in an Enum are a part of its data type and thus can only be changed during edit time. It is possible to read the strings of the Enum through a Property Node, but you cannot write them using a Property Node.

Note: If you have a large array of strings that you would like to populate an Enum with, you can simply replace the Enum with a text ring by right clicking on the Enum and selecting Replace and selecting the text ring. Create a property node to write to Strings and then run your program to write the string array to the property node. This will populate the text ring. Once the text ring is populated, you can "Replace" it with an Enum and it will retain all of the values from the text ring.