Datagridview multiselect and shift click

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
User avatar
Lembasts
Posts: 293
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Thu Mar 15, 2012 9:47 am

Datagridview multiselect and shift click

Post by Lembasts »

Greetings,
I have datagridview multiselect = true and I can check multiple checkbox cells individually however doing a click then shift-click to select multiple rows does not toggle all the check boxes, it just checks the first and last boxes. What is the best way to programatically implement shift-click to check all the boxes including the first and last?
Thanks
David

jvierra
Posts: 14445
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Datagridview multiselect and shift click

Post by jvierra »

Detect selection complete event and set the checkboxes programmatically. There is no auto-check like in a checked listbox.

User avatar
Lembasts
Posts: 293
Joined: Thu Mar 15, 2012 9:47 am

Re: Datagridview multiselect and shift click

Post by Lembasts »

Thanks. To be a huge help can you list the exact name of the event as there are alot of them!

jvierra
Posts: 14445
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Datagridview multiselect and shift click

Post by jvierra »

I should think by now that you can parse through the events as well as I can. If you fail by later - late tonight - I will go looking for you.

User avatar
Lembasts
Posts: 293
Joined: Thu Mar 15, 2012 9:47 am

Re: Datagridview multiselect and shift click

Post by Lembasts »

I have - I cannot find an event that has similar words to 'select' and 'complete'

jvierra
Posts: 14445
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Datagridview multiselect and shift click

Post by jvierra »

I had a bit of time to check this out. The event is called "RowStateChanged". This is the aggregate event sent for each row in a batch selection or when any row is selected or deselected.

User avatar
Lembasts
Posts: 293
Joined: Thu Mar 15, 2012 9:47 am

Re: Datagridview multiselect and shift click

Post by Lembasts »

Thanks - I thought that might be it but knowing its triggered for each row in a multi selection will do the trick.

Anayazius
Posts: 6
Joined: Tue Jun 23, 2020 5:04 am

Re: Datagridview multiselect and shift click

Post by Anayazius »

Thanks for the info

Post Reply