Version

SetValues Method

Sets the list of accepted values the cell can accept.
Syntax
public void SetValues( 
   params object[] values
)

Parameters

values
The list of accepted values.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionOccurs when values is null and the rule is currently applied to a Worksheet.
System.ArgumentExceptionOccurs when the values array is empty.
Remarks

If LimitedValueDataValidationRule.AllowNull is True, null values are allowed in addition to the list of accepted values.

All values will have ToString called on them to covert the accepted values list to a formula.

Note: the formula of accepted values is created by separating each value with a function parameter separator and concatenating them into a single string. So a list of 1, 2, and 3 would have the following formula created: ="1,2,3". However, if the decimal separator of the current culture is a comma (,) then a semicolon (;) will be used to separate the values instead. Because of this, if the ToString of a value returns a string which contains one of these separators, the value will be split into two or more allowed values.

Requirements

Target Platforms: Android 4.4+, iOS 8+

Development Environments: Visual Studio 2015+, Visual Studio for Mac Preview, Xamarin for Visual Studio 4.2+

See Also