I have a checkbox in a separate script and using dot scripting to add the box into the form. But when I return the checkbox back to the original script it does not pick up the checked state, it just stays as unchecked even if it is.
$checkBox = formCheckBox -checkLocW 30 -checkLocH 220 -checkSizeW 20 -checkSizeH 20 -checkText "Tick this"
#---------- When OK Pressed ----------#
if($form.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK){
Write-Host $password.Text
$setAccountName = $accountName.Text
$setSite = $site.Text
$setPassword = $password.text
Write-Host $checkBox.CheckState
--------------- dot script -------------------------------------------------
function formCheckBox($checkLocW,$checkLocH,$checkSizeW,$checkSizeH,$checkText){
$Checkbox = New-Object System.Windows.Forms.Checkbox
$Checkbox.Location = New-Object System.Drawing.Size($checkLocW,$checkLocH)
$Checkbox.Size = New-Object System.Drawing.Size($checkSizeW,$checkSizeH)
$Checkbox.Text = $checkText
$Checkbox.TabIndex = 4
$Form.Controls.Add($Checkbox)
return $Checkbox
}
Aucun commentaire:
Enregistrer un commentaire