1 of 1 people found this helpful
First of all, you appear to have a circular reference with how you have used myOpening. Secondly, the call to PIStateSets should be in context of an PIServer object. See Live Library Hlelp for PIStateSets. Note that an item from the StateSets is an AFEnumerationSet, that is there is no PIStateSet object, though if it helps you to think of it as such, you can name your variables accordingly. Likewise an AFEnumerationSet contains AFEnumerationValues (or to be accurate, it contains 1 or more).
There is a code example for AFEnumerationValues that you may find useful.