Articles in this section
Category / Section

How to programmatically select a row in WinForms Grid?

1 min read

Selection

By default, the selection can be done in grid by using mouse. In this article, it explains about adding the selection by programmatically for WinForms GridControl, GridGroupingControl and GridDataBoundGrid.
1. GridControl

C#

this.gridControl1.Selections.Add(GridRangeInfo.Row(3));

VB

Me.gridControl1.Selections.Add(GridRangeInfo.Row(3))

2. GridGroupingControl

The GridGroupingControl has two kinds of selections. They are

1.Range selection

2.Record selection

Range selections

C#

this.gridGroupingControl1.TableModel.Selections.Add(GridRangeInfo.Row(4));

VB

Me.gridGroupingControl1.TableModel.Selections.Add(GridRangeInfo.Row(4))

Record selection

The record selection can be done by using SetSelected method of Record which needs to be selected.

C#

this.gridGroupingControl1.Table. Recods[0].SetSelected(true);

VB

this.gridGroupingControl1.Table. Recods[0].SetSelected(True)

3. GridDataBoundGrid

Add the row in Selections from GridDataBoundGrid.

C#

this.gridDataBoundGrid1.Selections.Add(GridRangeInfo.Row(2));

VB

Me.gridDataBoundGrid1.Selections.Add(GridRangeInfo.Row(2))

Samples:

C#Selections

VBSelections


Conclusion

I hope you enjoyed learning about how to programmatically select a row in WinForms GridControl.

You can refer to our WinForms Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

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 forumsDirect-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)
Please sign in to leave a comment
Access denied
Access denied