Skip to main content

VGridRows.Item[Int32] Property

Gets a row object from the rows collection at the specified position.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid


public virtual BaseRow this[int index] { get; }


Name Type Description
index Int32

An integer value specifying the desired row’s zero-based index.

Property Value

Type Description

A BaseRow object representing a row located at a specific position within the rows collection.


Use this property to obtain a row at the specified location within the rows collection represented by the VGridRows object. The index parameter refers to the row’s BaseRow.Index property. You can use the VGridRows.IndexOf method to locate a row, or you can use the index returned from the VGridRows.Add method.

This property is an indexer for the VGridRows class. It gives the ability to access a specific row in the rows collection by using the following syntax:


The index number is zero-based. If the parameter value is negative or exceeds the maximum available index, an exception is raised.


The following example replaces the last row in the rows collection. This code assumes that a VGridControl and at least one Row object have been instantiated. The example gets the number of rows in the VGridControlBase.Rows collection and replaces the last row with a newly created one. The index value of the row being replaced is set to the Count property, minus one, since the VGridRows collection is zero-based indexed.

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

public void ReplaceLastRow() {
    // creating a new row bound to the specified field
    EditorRow newRow = new EditorRow("hire_date");
    newRow.Properties.Caption = "Hire Date";

    // replacing the last row in the collection.
    vGridControl1.Rows.Remove(vGridControl1.Rows[vGridControl1.Rows.Count - 1]);

See Also