LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert string to enum using LabVIEW 7.0

Solved!
Go to solution

Your enum is a typedef and it will only work if the string matches one of the items exactly. If it does, it works just fine. You cannot change the items of an enum at run time. What exactly are you trying to do?

 

altenbach_0-1589317373055.png

 

0 Kudos
Message 11 of 15
(1,903 Views)

altenbach,

 

Excuse me for jumping in.

 

"You cannot change the items of an enum at run time. What exactly are you trying to do?"

 

So, there is no way to fill the strings in an enum other than manually, correct?  I have a list of about 24 items I would like to have an an enum.  If there is another wy, I would like to know, for this and future uses.

 

Thanks, 

Roy

0 Kudos
Message 12 of 15
(1,760 Views)

You can't set the value of enum strings during run time of a program, but if you use VI scripting to create or edit the enum control while it's not running, then you can.

Create enum type def.png

 

Or, to do it without scripting, place down a Ring control, set its strings to what you want the enum strings to be using a property node, and then use the right-click-->Replace functionality to replace the Ring with an Enum, and your enum now has all the values that your Ring did.

0 Kudos
Message 13 of 15
(1,749 Views)

Yes, there is a "way to fill the strings". you just cannot do it "at runtime". (Runtime  is the important part)

You can modify the enum from a different vi through scripting. In fact I have done the same thing as you want to do so many times I created my own tool for it.

 

Load Enum.png

 

Where "Your Enum.vi" contains the enum you want to modify.

Frozen_0-1606778098385.png

 

Hope this helps.

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 14 of 15
(1,742 Views)

Thanks, all, for the quick replies.  I now have several solutions and a new tool for my toolbox (thanks, Frozen).

0 Kudos
Message 15 of 15
(1,737 Views)