How to Determine that no Cell is Selected in Windows Forms GridDataBoundGrid(Classic)

9 Dec 2019 / 1 minute to read

To determine whether the cell is selected or not, use GetSelectedRange method. It returns the list with selected range. If it returns the range as zero, then no cell is selected.

  • ranges - It sets the range of cells to be selected.
  • ConsiderCurrentCell

True - If the current cell should be treated as selected range.

GridRangeInfoList rangeList = null;
this.gridDataBoundGrid1.Selections.GetSelectedRanges(out rangeList, false);

if (rangeList.Count == 0)
    Console.WriteLine("no selection");
Dim rangeList As GridRangeInfoList = Nothing
If rangeList.Count = 0 Then
Console.WriteLine("no Selection")
End If