Habanero.Faces.Base.DateRangeComboBoxManager.SetDateRangeString C# (CSharp) Method

SetDateRangeString() public method

Amends the display string for a given date option
public SetDateRangeString ( DateRangeOptions option, string newDisplayString ) : void
option DateRangeOptions The date option to amend
newDisplayString string The display string to apply
return void
        public void SetDateRangeString(DateRangeOptions option, string newDisplayString)
        {
            if (_optionsToDisplay.Contains(option))
            {
                if (_dateRangePairs.ContainsValue(newDisplayString)
                    && _dateRangePairs[option] != newDisplayString)
                {
                    throw new ArgumentException("A date range display string " +
                        "is being assigned, but that display string has already " +
                        "been used.");
                }
                int comboBoxPos = _comboBox.Items.IndexOf(_dateRangePairs[option]);
                _comboBox.Items[comboBoxPos] = newDisplayString;
                _dateRangePairs[option] = newDisplayString;
            }
            else
            {
                throw new ArgumentException("A date range string is being changed, " +
                    "but the given option does not exist in the collection " +
                    "of date options.");
            }
        }