Check all checkboxes not from column header

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.
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
pjbuckley
Posts: 31
Last visit: Mon Jan 06, 2020 12:21 pm

Re: Check all checkboxes not from column header

Post by pjbuckley »

Ok. I obviously need to show you the code i am working on. It is one piece of a much larger app that ive built entirely using Notepad++ as my editor. Its a bit messy cause i have a few things im working but you may see some of the resent datasource bindings code-bits that you helped me with before.

It is in this 'function' that i need to apply the Select All checkbox functionality to.
Attachments
Gdata-converttoTable.ps1
(13.43 KiB) Downloaded 94 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Check all checkboxes not from column header

Post by jvierra »

Stop and think about this. We set the state of a columns checkbox in the data and not in the column. Just add a Boolean to the data that is the checkbox column and its value will determine the state of th checkbox.

Please review the code posted. It clearly shows how to do this without a lot of functions and other code. It does exactly what you are trying to do. Once you understand how a grid binds to a table with a DataTable and ho9w it takes only few lines of code to do this then you will be able to deign your form. Without a good sense of how forms and databinding work especially with the gridview you will be throwing darts in the ark.
pjbuckley
Posts: 31
Last visit: Mon Jan 06, 2020 12:21 pm

Re: Check all checkboxes not from column header

Post by pjbuckley »

Ah. I have been trying to affect the column or cell rather than the data itself. That makes sense now why i couldnt find a method or property to change it.

I will try it from that perspective next.

Thank you!
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked