Accord.Controls.ArrayRowView.SetColumnValue C# (CSharp) Method

SetColumnValue() public method

Sets a value to the element at the specified position of this row.
public SetColumnValue ( int index, object value ) : void
index int The index of the element to set.
value object The new value for the specified element.
return void
        public void SetColumnValue(int index, object value)
        {
            try
            {
                if (owner.ArrayData.Rank == 2)
                {
                    owner.ArrayData.SetValue(value, this.rowIndex, index);
                }
                else
                {
                    owner.ArrayData.SetValue(value, index);
                }
            }
            catch (ArgumentException e)
            {
                error = e.ToString();
            }
            catch (InvalidCastException e)
            {
                error = e.ToString();
            }
            catch (IndexOutOfRangeException e)
            {
                error = e.ToString();
            }
        }

Usage Example

        /// <summary>
        ///   Sets a value to the array.
        /// </summary>
        ///
        public override void SetValue(object component, object value)
        {
            ArrayRowView rowView = component as ArrayRowView;

            if (rowView != null)
            {
                rowView.SetColumnValue(columnIndex, value);
            }
        }