Articles in this section

How to move focus to specific row or specific cell through code in WinForms GridControl?

Focus the grid cell

The focus can be moved to a particular cell or Row by using the CurrentCell.MoveTo method of the Grid.

//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));
'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


Conclusion

I hope you enjoyed learning about how to move focus to a specific row or a specific cell through code in the WinForms GridControl.


You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms GridControl example to understand how to create and manipulate data.

 

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.


If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied