0
votes

I am using Data Grid View control in my project and the requirement is below. Row Headers Visible = true, Column Headers Visible = true, Multiple Select = true, Selection Mode = Full Row Select. Allow multiple rows selection true but do not allow to select all rows when user clicks on top left cell.

Please help me!!!!!!!

3

3 Answers

0
votes

The top left cell's only purpose is to select all the cells, I don't think that could be disabled.

In any case you can use a if condition to check whether all the rows are selected and proceed accordingly.

ps: I am new to C# and dont know much

0
votes

Thanks to @anchandra response from this other SO thread you may accomplish that behavior by overriding the OnCellMouseDown behaviour:

protected override void OnCellMouseDown(DataGridViewCellMouseEventArgs e)
{
    if (e.RowIndex == -1 && e.ColumnIndex == -1) return;
    base.OnCellMouseDown(e);
}
-1
votes

Set the RowHeadersVisible to false.