Check of Checkboxes

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.
Locked
boskap
Posts: 21
Joined: Sun Jul 15, 2018 4:00 pm

Check of Checkboxes

Post by boskap » Sat Aug 25, 2018 10:37 am

Sorry for that title

i hafe a gui like an software installer where you can check checkboxes
press a start button
the tasks will run

but i want to popup a messagebox when all tasks are done
whats the best way

i think about to check of any checkbox is checked and when yes start messagebox
but how ?

thx Peter

User avatar
jvierra
Posts: 13577
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Check of Checkboxes

Post by jvierra » Sat Aug 25, 2018 10:47 am

[System.Windows.Forms.MessageBox]::Show('your message')

See: https://info.sapien.com/index.php/guis/ ... dlYm94Il0=

boskap
Posts: 21
Joined: Sun Jul 15, 2018 4:00 pm

Re: Check of Checkboxes

Post by boskap » Sat Aug 25, 2018 10:58 am

how i make a messagebox i know

but i only want to show it after the tasks of software installation
so i must check if any checkbox is checked and when yes show the message box

how i check them all

User avatar
jvierra
Posts: 13577
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Check of Checkboxes

Post by jvierra » Sat Aug 25, 2018 11:50 am

Code: Select all

if($checkbox1.Checked){
      # box checked
}else{
     # bos not checked
}
See: https://info.sapien.com/index.php/guis/ ... ox-control

For most GUI items and usage check here: https://info.sapien.com/index.php/guis/gui-controls

boskap
Posts: 21
Joined: Sun Jul 15, 2018 4:00 pm

Re: Check of Checkboxes

Post by boskap » Sat Aug 25, 2018 2:19 pm

thx
but thats also clear
so i install my software after press the startbutton

is it possible to check all at the same time with a variable

i dont want querry checkbox1, checkbox2 and......
i like if checkbox*.checked or so in this form then

thx

User avatar
jvierra
Posts: 13577
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Check of Checkboxes

Post by jvierra » Sat Aug 25, 2018 2:54 pm

That is not how Forms and PowerShell work.

Read the articles here: https://info.sapien.com/index.php/guis

Here is a good tutorial to get you started with PowerShell: https://mva.microsoft.com/en-us/trainin ... shell-8276

Locked