Category / Section
How to prevent the cell or column from being a part of the selection in WinForms GridControl?
Prevent the grid cell or column
In WinForms GridControl, you can use the grid’s SelectionChanging event to cancel a selection depending on the criteria that you have specified.
void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
//prevent cell from selection
if(e.Range.Contains(GridRangeInfo.Cell(2,2)))
e.Cancel=true;
//prevent column from selection
if(e.Range.IntersectsWith(GridRangeInfo.Col(3)))
e.Cancel=true;
}Private Sub gridControl1_SelectionChanging(ByVal sender As Object, ByVal e As GridSelectionChangingEventArgs)
'prevent cell from selection
If e.Range.Contains(GridRangeInfo.Cell(2,2)) Then
e.Cancel=True
End If
'prevent column from selection
If e.Range.IntersectsWith(GridRangeInfo.Col(3)) Then
e.Cancel=True
End If
End SubSamples: