10-17-2008 05:16 PM
Hello,
I was wondering if it was possible to create an ENUM dynamically? For example, I would like to read in values from a string array and use each element to add a new item in the ENUM control. If this isn't possible, how do I configure a case structure to read in the values from a string array like an ENUM would normally be able to? It would help tremendously if I didn't have to manually enter the string name for each particular case. Thanks so much.
Solved! Go to Solution.
10-17-2008 06:11 PM
Search the forum, you'll find this question has been asked many times before.
Short answer is: no, it's not possible to populate an enum at runtime. Also, if you don't know what values the enum can have at runtime what cases should the case structure have?
So if you know the values at design time, you can use an enum. If not, use a ring.
Hope this helps,
Daniel
10-18-2008 09:52 AM
Ditto Dan's comments.
If you are asking because you just want to save a lot of work at edit time you could wrie all of your strings to a ring and then afterwards right-click and choose replace >>> enum and the object will change to an enum with all of the ring's strings.
Remember to include default case since you are dealing with strings.
I hope that helps,
Ben
10-18-2008 01:36 PM
However if you have a lot of strings and want to create an enum, you can do this one initial time.
See the LabVIEW code repository.
Ton
10-20-2008 01:27 AM
11-25-2011 10:56 AM
great idea for saving time!
12-09-2013 09:26 PM
Presumably you are the same person on LAVA that claimed to have code to take an array and make it into an strict type def enum. A) your code doesn't work because it cannot be encorporated into projects (password protected, etc), B) If you are going to provide solutions on a public help forum why do a password protect on the code.
12-10-2013 02:23 AM
12-10-2013 04:29 AM
The words in that post sound very familiar, but I couldn't find the thread. I wonder if this is a spambot about to happen...