How to uncheck checkbox

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 9 months and 3 weeks 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
User avatar
debratton
Posts: 9
Last visit: Fri Jan 26, 2024 11:02 am

How to uncheck checkbox

Post by debratton »

I have two checkboxes with CheckedChanged events. For some reason I cannot uncheck them with function TAGS-RESET call below. Any suggestions?

$checkboxMultipleDisplays_CheckedChanged = {
if ($checkboxMultipleDisplays.Checked = $true)
{
$global:objTag1 = "Multiple Displays"
}
else
{
$global:objTag1 = ""
}
}

$checkboxCustomSeating_CheckedChanged = {
if ($checkboxCustomSeating.Checked = $true)
{
$global:objTag2 = "Customizable Seating"
}
else
{
$global:objTag2 = ""
}
}
#region TAGS
function TAGS-RESET
{
$checkboxMultipleDisplays.Checked = $false
$checkboxMultipleDisplays.Enabled = $false
$checkboxCustomSeating.Checked = $false
$checkboxCustomSeating.Enabled = $false
$global:objTag1 = ""
$global:objTag2 = ""
}

function TAGS-ENABLE
{
$checkboxMultipleDisplays.Enabled = $true
$checkboxMultipleDisplays.Checked = $false
$checkboxCustomSeating.Enabled = $true
$checkboxCustomSeating.Checked = $false
$global:objTag1 = ""
$global:objTag2 = ""
}

#endregion
File
File
Capture.PNG (5.08 KiB) Viewed 609 times
User avatar
debratton
Posts: 9
Last visit: Fri Jan 26, 2024 11:02 am

Re: How to uncheck checkbox

Post by debratton »

This is resolved. Coding error...

if ($checkboxMultipleDisplays.Checked = $true) should be if ($checkboxMultipleDisplays.Checked -eq $true)
This topic is 9 months and 3 weeks 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