Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Disabling SetSelectedRowCore without infinite loop

$
0
0

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


Viewing all articles
Browse latest Browse all 2535

Trending Articles