简体   繁体   English

单击按钮后如何将Powershell复选框设置为False

[英]How can I set Powershell check box to False after button click

I am creating a Powershell GUI, I have a Checkbox that will force the user to change password on logon. 我正在创建Powershell GUI,我有一个复选框,它将强制用户在登录时更改密码。 I have the textbox for the password set to clear and it works fine, but I cannot find a way to uncheck the Box programmatically. 我已将密码设置为清除文本框,并且可以正常工作,但是找不到以编程方式取消选中“框”的方法。 I have tried $CheckBoxRLO.Checked -eq $true After the code to reset the password but the box stays checked. 我尝试过$ CheckBoxRLO.Checked -eq $ true在重置密码的代码之后,但此框保持选中状态。

You need to assign it value false. 您需要为其分配值false。 What you're right now doing is using binary operator -eq, it compares two values (left hand, right hand) and either returns false or true, this is not what you want to do. 您现在正在执行的操作是使用二进制运算符-eq,它比较两个值(左手,右手),然后返回false或true,这不是您想要执行的操作。

Try 尝试

$CheckBoxRLO.Checked = $false

$CheckBoxRLO.Checked = $false worked, I swear I tried it as well but I must have done 20 things besides it. $CheckBoxRLO.Checked = $false有效,我发誓也尝试过,但除此以外我还必须做20件事。 Thank you ! 谢谢 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM