Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 在填充文本框之前禁用$OK按钮?_Powershell_Textbox - Fatal编程技术网

Powershell 在填充文本框之前禁用$OK按钮?

Powershell 在填充文本框之前禁用$OK按钮?,powershell,textbox,Powershell,Textbox,我有一个关于事件触发器的问题。我希望在填充文本框之前禁用OKButton,这几乎需要用户在该字段中输入数据或从表单中取消。我已经有了$OKButton.enabled=$false,我想我需要一些类似的东西 if ($Textbox3.Text.Length <1) { $OKButton.enabled = $true } else { $OKButton.enabled = $false } 如果在PowerShell中使用($Textbox3.Text.Length

我有一个关于事件触发器的问题。我希望在填充文本框之前禁用OKButton,这几乎需要用户在该字段中输入数据或从表单中取消。我已经有了
$OKButton.enabled=$false
,我想我需要一些类似的东西

if ($Textbox3.Text.Length <1) {
    $OKButton.enabled = $true
} else {
    $OKButton.enabled = $false
}

如果在PowerShell中使用($Textbox3.Text.Length,则“小于”比较运算符不是
$Textbox3.Text.Length-lt 1
谢谢Mathias的帮助
if ($Textbox3.Text.Length -lt 1) {
    $OKButton.enabled = $true
} else {
    $OKButton.enabled = $false
}