How to get the selected ranges in the WinForms GridControl?
Select the range in grid
The GridControl.Selections.Ranges is a list that holds the currently selected ranges. You can iterate through this list by using the following code examples.
//In GridControl
//get the currently selected ranges
foreach (GridRangeInfo r in gridControl1.Selections.Ranges)
MessageBox.Show(r.ToString());
[OR]
//get the selected ranges using ActiveRange
GridRangeInfo active = this.gridControl1.Selections.Ranges.ActiveRange;
MessageBox.Show(active.ToString());
//In GridDataBoundGrid
//get the currently selected ranges
foreach (GridRangeInfo r in gridDataBoundGrid1.Selections.Ranges)
MessageBox.Show(r.ToString());
[OR]
//get the selected ranges using ActiveRange
GridRangeInfo active = this. gridDataBoundGrid1.Selections.Ranges.ActiveRange;
MessageBox.Show(active.ToString());'In GridControl
'get the currently selected ranges
For Each r As GridRangeInfo In gridControl1.Selections.Ranges
MessageBox.Show(r.ToString())
Next r
[OR]
'get the selected ranges using ActiveRange
Dim active As GridRangeInfo = Me.gridControl1.Selections.Ranges.ActiveRange
MessageBox.Show(active.ToString())
'In GridDataBoundGrid
'get the currently selected ranges
For Each r As GridRangeInfo In gridDataBoundGrid1.Selections.Ranges
MessageBox.Show(r.ToString())
Next r
[OR]
'get the selected ranges using ActiveRange
Dim active As GridRangeInfo = Me. gridDataBoundGrid1.Selections.Ranges.ActiveRange
MessageBox.Show(active.ToString()) The following
screenshot displays the grid after applying the properties.

Figure 1: Get the selected ranges in the grid.
Samples: