Powershell and Forms (part 3) – Checkboxes

Checkboxes in Forms

My last post was about populating a second dropdown list with data that was gathered from a choice made in the first dropdown list.  I know, I jumped ahead of myself.  Today’s post is about checkboxes in forms.  The checkbox is a very common element in forms. Having a checkbox on your form always looks nice (don’t go over the top and put too many in your form).

The script below is a nice example of how to enable and disable the OK button by checking the checkbox.

The most common usage I have seen for checkboxes is on a survey, or when you agree to a license agreement during a software install. Have fun playing with the controls and feel free to comment.

5 comments

  1. i try to make a backuptool with folder copy. but the script starts to copy all folders before i can choose one of my 3 checkboxes (each for other folder). Pls help me, i read many in google… but not found anything for my problem

    #######################################################
    #$checkbox1.Add_CheckStateChanged({
    #$OKButton.Enabled = $checkbox1.Checked })

    If ($checkbox1.Checked = $true) { copy-item “C:\Users\Bernd PC\Links\” “D:\111\Links\” -recurse }
    If ($checkbox2.Checked = $true) { copy-item “C:\Users\Bernd PC\Favoriten\” “D:\111\Favoriten\” -recurse }

Leave a Reply

Your email address will not be published. Required fields are marked *