Skip to main content
A newer version of this page is available. .

VGridControlBase.SetCellValue(BaseRow, Int32, Object) Method

Sets the value of the specified cell.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v18.2.dll

Declaration

public virtual void SetCellValue(
    BaseRow gridRow,
    int recordIndex,
    object value
)

Parameters

Name Type Description
gridRow BaseRow

A BaseRow descendant that represents the row which contains the cell.

recordIndex Int32

An integer value which identifies the record in which the cell resides.

value Object

An object that represents the cell’s new value.

Remarks

For more information, see Obtaining and Setting Cell Values.

Example

The following sample code handles the VGridControlBase.CellValueChanged event to sum up the prices of the selected games in the purchase order list. The image below shows the result.

GetCellValue_SetCellValue

using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Rows;
using DevExpress.XtraVerticalGrid.Events;

private void vGridControl1_CellValueChanged(object sender, CellValueChangedEventArgs e) {
   double sum = 0;
   BaseRow row = vGridControl1.GetFirst();
   while (vGridControl1.GetNext(row) != null){
      if (row.XtraRowTypeID == 2){
         if (Convert.ToBoolean(vGridControl1.GetCellValue(row as MultiEditorRow, 0, 0)) == true)
            sum += Convert.ToDouble(vGridControl1.GetCellValue(row as MultiEditorRow, 0, 1));
      }
      row = vGridControl1.GetNext(row);
   }
   vGridControl1.SetCellValue(rowPrice, 0, sum);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetCellValue(BaseRow, Int32, Object) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also