给出以下 PowerShell Studio 代码,我如何调用和禁用“Checkit”按钮下的“David Checkbox”。我知道我以某种方式搞砸了复选框声明,因为 powershell 无法将我的复选框识别为对象:
在此对象上找不到属性“已启用”。验证该属性是否存在并且可以设置。
$accounts = "David", "Dave"
$buttonLoadLabels_Click = {
$CheckBoxCounter = 1
$accounts = 'didier','david'
foreach ($account in $accounts)
{
$label = New-Object System.Windows.Forms.Label
$label.Text = $account
$label.TextAlign = 'MiddleCenter'
$label.Font = $label1.Font
$flowlayoutpanel1.Controls.Add($label)
$CB = New-Object System.Windows.Forms.CheckBox
$CB.Name = $account
Write-Host $CB.Name
$flowlayoutpanel1.Controls.Add($CB)
}
}
$buttonCheckIt_Click = {
$checkbox_David.Enabled = $false
}