Xceed Grid for WinForms v4.3 Documentation
Welcome to Xceed Grid for WinForms v4.3 / Task-Based Help / Rows / How to change the current row

In This Topic
    How to change the current row
    In This Topic

    The grid's current row can be changed using the grid's CurrentRow property or the MoveCurrentRow method. Any visible row, not just DataRows, can be the current row. 

    Keep in mind that the current row might or might not be part of the grid's SelectedRows. If you want to the current row to be selected, you will need to add it to the grid's collection of selected rows. 

    Only rows whose CanBeCurrent property is set to true can be current. 

    If the row is in a collapsed group or its Visible property is set to false, and exception will be thrown.

    Demonstration

    The following examples demonstrate how to make various rows current:

    VB.NET Copy Code

    GridControl1.CurrentRow = GridControl1.DataRows( 42 ) 
    GridControl1.CurrentRow = GridControl1.FixedFooterRows( 0 ) 
    GridControl1.CurrentRow = GridControl1.Groups( 0 ).HeaderRows( 1 )

    C# Copy Code

    gridControl1.CurrentRow = gridControl1.DataRows[ 42 ]; 
    gridControl1.CurrentRow = gridControl1.FixedFooterRows[ 0 ]; 
    gridControl1.CurrentRow = gridControl1.Groups[ 0 ].HeaderRows[ 1 ];

    When setting the CurrentRow property or calling the MoveCurrentRow method, the BringIntoView method must be called if you want to bring the new current row into view.