Reputation: 11
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!!!!!!!
Upvotes: 0
Views: 1210
Reputation: 2405
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);
}
Upvotes: 0
Reputation: 3
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
Upvotes: 0