Disabling SetSelectedRowCore without infinite loop

  • Thread starter Thread starter Nathan K S
  • Start date Start date
N

Nathan K S

Guest
When I set CurrentCell it has the side effect of changing the selected rows as well. This is probably because I set

SelectionMode = DataGridViewSelectionMode.FullRowSelect;

I would like to disable this behavior and simply set the CurrentCell without changing the selected rows. I tried overriding the code to set the selected rows as follows

protected override void SetSelectedRowCore(int rowIndex, bool selected) {
if (filtered) return;

base.SetSelectedRowCore(rowIndex, selected);
}

However, I end up in an infinite loop until I actuall call the base.SetSelectedRow(), Is there any way to set the CurrentCell without affecting the Selected property?

Thank you,

Nathan

Continue reading...
 
Back
Top