Category / Section
How to move focus to specific row or specific cell through code in WinForms GridControl?
2 mins read
Focus the grid cell
The focus can be moved to a particular cell or Row by using the CurrentCell.MoveTo() method of the Grid.
C#
//Sets focus to the particular cell. this.gridControl1.CurrentCell.MoveTo(2, 3, GridSetCurrentCellOptions.SetFocus); //Sets focus to the particular row. this.gridControl1.CurrentCell.MoveTo(GridRangeInfo.Row(4));
VB
'Sets focus to the particular cell. Me.gridControl1.CurrentCell.MoveTo(2, 3, GridSetCurrentCellOptions.SetFocus) 'Sets focus to the particular row. Me.gridControl1.CurrentCell.MoveTo(GridRangeInfo.Row(4))
The following screenshot displays the focused cell.
Figure 1: The Current cell Focus is moved to the cell(2,3)
Samples: