08-05-2021 04:58 AM
I have an Enum , Enums.State with many states likeCommand1,..2, 3 etc
I want to programatically change these values with a For loop.
How to send enum variables values from an Integer ?
Thanks Akshay
08-05-2021 09:25 AM
Not sure if you've read through the help on this but assignment can only be done with enums of the same type: https://zone.ni.com/reference/en-XX/help/370052AA-01/tsfundamentals/infotopics/enumsastsexpressions/
However, you can use the SetValNumber and the coerce to enum flag:
Locals.MyEnum.SetValNumber("", 0x18, 1) where MyEnum is the enum and 1 is the numeric selection I want to make it. n 0x18 is the flag for coerce to enum:
Hope this helps,
08-09-2021 03:16 AM
Thanks a lot jigg for the answer, I will test it.
08-15-2021 07:02 AM
I think Sam's answer should be marked as a solution. I'm just saying 😉
This site uses cookies to offer you a better browsing experience. Learn more about our privacy statement and cookie policy.