NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
Skeptical
Posts: 62
0 Kudos
Accepted Solution

Non-sequential enum causes error

When calling a .NET object that has a property that sets an enum value, I am getting a runtime error in the .NET code if the enum is defined such that each value is not a sequential number (as in a bit mask). If the values are sequential there is no problem. In both cases, the sequence editor shows a drop down with the names of the enum values but puts the name in quotes.

 

Does TestStand handle enums with non-sequential values properly?

Active Participant
dug9000
Posts: 1,502
0 Kudos

Re: Non-sequential enum causes error

[ Edited ]

What version of TestStand are you using? Are you passing the values as a string or as a number? How are you constructing the combined value (i.e. what does your expression for the parameter look like)?

 

-Doug

Active Participant
dug9000
Posts: 1,502
0 Kudos

Re: Non-sequential enum causes error

[ Edited ]

It works for me if I specify the values separated by commas or specify the value numerically. For example:

 

    [Flags]

    public enum mybitfield
    {
        myval1 = 0x1,
        myval2 = 0x2
    }

For the above bitfield, to specify both values for a parameter you can either specify:

 

"myval1, myval2"

0x1 | 0x2

0x3

 

Any of the above worked for me in both TestStand 4.2.1 and TestStand 2010.

 

Hope this helps,

-Doug

Member
Skeptical
Posts: 62
0 Kudos

Re: Non-sequential enum causes error

Thanks. I've gotten diverted on something else so I haven't been able to respond. I'll look at it again.

 

Thanks for your respons.

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page