Back to Devexpress

CellRange.TopRowIndex Property

officefileapi-devexpress-dot-spreadsheet-dot-cellrange-a9f2d171.md

latest7.9 KB
Original Source

CellRange.TopRowIndex Property

Gets the index of the row that includes the top edge of the cell range.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
int TopRowIndex { get; }
vb
ReadOnly Property TopRowIndex As Integer

Property Value

TypeDescription
Int32

An integer value specifying the zero-based index of the row.

|

Remarks

Use the TopRowIndex , CellRange.BottomRowIndex, CellRange.LeftColumnIndex and CellRange.RightColumnIndex properties to get indexes of rows and columns that border the cell range.

To obtain the number of rows or columns in the cell range, use the CellRange.RowCount or CellRange.ColumnCount property, respectively.

The following code snippets (auto-collected from DevExpress Examples) contain references to the TopRowIndex property.

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.

wpf-spreadsheet-bind-spreadsheet-to-ms-sql-server-database/CS/WpfSpreadsheet_BindToDataSource/MainWindow.xaml.cs#L148

csharp
// Verify that the selected cell range belongs to the data-bound range.
if (!boundRange.IsIntersecting(selectedRange) || selectedRange.TopRowIndex < boundRange.TopRowIndex)
{

winforms-spreadsheet-bind-to-ms-sql-server-database/CS/SuppliersExample/Form1.cs#L126

csharp
// Verify that the selected cell range belongs to the data-bound range.
if (!boundRange.IsIntersecting(selectedRange) || selectedRange.TopRowIndex < boundRange.TopRowIndex) {
    MessageBox.Show("Select a record first!", "Remove Record", MessageBoxButtons.OK, MessageBoxIcon.Error);

how-to-bind-a-worksheet-to-a-generic-list-or-a-bindinglist-data-source/CS/DataBindingToListExample/Form1.cs#L41

csharp
Where(binding => (binding.Range.RightColumnIndex >= bindingRange.LeftColumnIndex)
    || (binding.Range.BottomRowIndex >= bindingRange.TopRowIndex)) ;
if (dataBindingConflicts.Count() > 0) {

winforms-spreadsheet-import-data-from-a-datatable-instance/CS/Form1.cs#L27

csharp
spreadsheetControl1.BeginUpdate();
activeWorksheet.Import(ManualDataSet.CreateData().Tables[0], true, selection.TopRowIndex, selection.LeftColumnIndex);
spreadsheetControl1.EndUpdate();

winforms-spreadsheet-use-custom-cell-editors/CS/DevAVInvoicing/Form1.cs#L161

csharp
spreadsheetControl1.CloseCellEditor(CellEditorEnterValueMode.Cancel);
sheet.Rows.Remove(sheet.SelectedCell.TopRowIndex, 1);
EnableControls();

wpf-spreadsheet-bind-spreadsheet-to-ms-sql-server-database/VB/WpfSpreadsheet_BindToDataSource/MainWindow.xaml.vb#L126

vb
' Verify that the selected cell range belongs to the data-bound range.
If Not boundRange.IsIntersecting(selectedRange) OrElse selectedRange.TopRowIndex < boundRange.TopRowIndex Then
    MessageBox.Show("Select a record first!", "Remove Record", MessageBoxButton.OK, MessageBoxImage.Error)

winforms-spreadsheet-bind-to-ms-sql-server-database/VB/SuppliersExample/Form1.vb#L120

vb
' Verify that the selected cell range belongs to the data-bound range.
If Not boundRange.IsIntersecting(selectedRange) OrElse selectedRange.TopRowIndex < boundRange.TopRowIndex Then
    MessageBox.Show("Select a record first!", "Remove Record", MessageBoxButtons.OK, MessageBoxIcon.Error)

how-to-bind-a-worksheet-to-a-generic-list-or-a-bindinglist-data-source/VB/DataBindingToListExample/Form1.vb#L43

vb
Function(binding)
    Return (binding.Range.RightColumnIndex >= bindingRange.LeftColumnIndex) OrElse (binding.Range.BottomRowIndex >= bindingRange.TopRowIndex)
End Function)

winforms-spreadsheet-import-data-from-a-datatable-instance/VB/Form1.vb#L30

vb
spreadsheetControl1.BeginUpdate()
activeWorksheet.Import(ManualDataSet.CreateData().Tables(0), True, selection.TopRowIndex, selection.LeftColumnIndex)
spreadsheetControl1.EndUpdate()

winforms-spreadsheet-use-custom-cell-editors/VB/DevAVInvoicing/Form1.vb#L149

vb
If spreadsheetControl1.IsCellEditorActive Then spreadsheetControl1.CloseCellEditor(CellEditorEnterValueMode.Cancel)
sheet.Rows.Remove(sheet.SelectedCell.TopRowIndex, 1)
EnableControls()

See Also

BottomRowIndex

LeftColumnIndex

RightColumnIndex

How to: Access a Range of Cells

How to: Access a Row or Column

CellRange Interface

CellRange Members

DevExpress.Spreadsheet Namespace