VGridControlBase.SetCellValue(MultiEditorRow, Int32, Int32, Object) Method
Assigns a value to a cell in a multi-editor row.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
Declaration
public virtual void SetCellValue(
MultiEditorRow meRow,
int recordIndex,
int cellIndex,
object value
)
Parameters
Name | Type | Description |
---|---|---|
meRow | MultiEditorRow | The row that contains the cell. |
recordIndex | Int32 | The index (visual position) of the record that contains the cell. |
cellIndex | Int32 | The index of the cell in a multi-editor row. |
value | Object | An object that specifies the cell’s new value. |
Remarks
Use the GetCellValue or SetCellValue method to obtain or set a cell value. To identify the cell, use the field name (which specifies a row) and record index (which specifies a column). You can also use an EditorRow, MultiEditorRow, or RowProperties object to specify a row. For multi-editor rows (which display multiple cells in a single column), you should also specify the cell index. The image below illustrates cells in a single- and multi-editor row.
// Cell is identified by a field name and record index.
vGridControl.SetCellValue(fieldName: "Name", recordIndex: 0, value: "Touareg");
// Cell is identified by a single-editor row object and record index.
vGridControl.SetCellValue(gridRow: erName, recordIndex: 0, value: "Touareg");
// Cell is identified by a multi-editor row object, record index and cell index.
vGridControl.SetCellValue(meRow: merTransmmision, recordIndex: 0, cellIndex: 1, value: 8);
// Cell is identified by a row properties object and record index.
vGridControl.SetCellValue(props: merpTransmissionSpeeds, recordIndex: 0, value: 8);
If you obtain or set the focused row’s value, check if the focused row is an EditorRow or MultiEditorRow, and then use the method’s corresponding overload.
string focusedCellValue = string.Empty;
if (vGridControl1.FocusedRow is DevExpress.XtraVerticalGrid.Rows.EditorRow)
focusedCellValue = vGridControl1.GetCellValue(vGridControl1.FocusedRow, vGridControl1.FocusedRecord).ToString();
Important
If the specified value’s type and the data field’s type do not match, the InvalidValueException event is raised. See the following topic for more information: Validation.