Back to Devexpress

RowCollection.Item[Int32] Property

officefileapi-devexpress-dot-spreadsheet-dot-rowcollection-dot-item-x28-system-dot-int32-x29.md

latest2.9 KB
Original Source

RowCollection.Item[Int32] Property

Provides indexed access to individual rows in the collection.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
Row this[int rowIndex] { get; }
vb
ReadOnly Property Item(rowIndex As Integer) As Row

Parameters

NameTypeDescription
rowIndexInt32

A zero-based integer specifying the desired row’s position within the collection. If it’s negative or exceeds the last available index (a worksheet limits the number of rows to 1048576), an exception is raised.

|

Property Value

TypeDescription
Row

A Row object which specifies the row at the specified position.

|

Remarks

Use the Item property to access individual rows using index notation.

Example

This example demonstrates how to access rows in a worksheet. Use the Worksheet.Rows property to get a collection of rows contained in a worksheet (the RowCollection object). To get an individual row by its index (zero-based) or heading (“1”, “2”, “3”, etc.), use the RowCollection.Item property.

csharp
using DevExpress.Spreadsheet;
// ...

Workbook workbook = new Workbook();

// Access a collection of rows.
RowCollection rows = workbook.Worksheets[0].Rows;

// Access the first row by its index in the collection of rows.
Row firstRow_byIndex = rows[0];

// Access the first row by its unique name.
Row firstRow_byName = rows["1"];
vb
Imports DevExpress.Spreadsheet
' ...

Dim workbook As New Workbook()

' Access a collection of rows.
Dim rows As RowCollection = workbook.Worksheets(0).Rows

' Access the first row by its index in the collection of rows.
Dim firstRow_byIndex As Row = rows(0)

' Access the first row by its unique name.
Dim firstRow_byName As Row = rows("1")

See Also

RowCollection Interface

RowCollection Members

DevExpress.Spreadsheet Namespace