Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

accessing values from valid values formula.

Experimenter
Experimenter

I am having a valid values list . How to access it during run time? In the c#, it is done through List[i] , so can we do it through propertyname[i]? 

3 REPLIES

Re: accessing values from valid values formula.

Pioneer
Pioneer

Let's say you want to access ValidValues on a property named 'Options' on the rootpart, you do it in following manner:

 

Dim s As String = RootPart.ValidValues("Options").FirstVDisplayValue

 

The above line will give you the first item in the options valid values list. If you want to access the list itself it would be:

 

Dim vv As ValidValues = RootPart.ValidValues("Options")

 

Dharmesh

Re: accessing values from valid values formula.

Valued Contributor
Valued Contributor

If you want to iterate, ValidValues contains two "arrays" Values and Keys (both of RsCollection type if I remember well).

So if you need Keys something like this should work ...ValidValues("name").Keys(i). Or you can cast it to IEnumerable and use Linq

Re: accessing values from valid values formula.

Pioneer
Pioneer

Correct, with one clarification..the 2 arrays are of type System.Collections.ICollection (interface) instead of rsCollection.

 

Dharmesh