Articles in this section
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.

Current cell focus is moved to another cell

Figure 1: The Current cell Focus is moved to the cell(2,3)

Samples:

C#: SetFocusThroughCode

VB: SetFocusThroughCode

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied