mercredi 24 juillet 2019

Powershell: Get content from checked checkbox

My problem is the following: I create a checkbox with the code displayed and a button. If I click the button, the checked items shell be put into the $selectedCusts array. But whatever I've tried - Nothing worked.

Any help is appreciated. :-)

Thanks in advance german_erd

$cbheight = 0
foreach ($c in $customer)
{
    $cbheight                       += 20
    $checkBox                       = New-Object System.Windows.Forms.checkBox 
    $checkBox.Font                  = "Microsoft Sans Serif,14"
    $checkBox.Name                  = "$c"
    $checkBox.Text                  = "$c"
    $checkbox.Location              = new-object System.Drawing.Size(20,$cbheight)
    $checkbox.Size                  = new-object System.Drawing.Size(345,23)
    $checkBox.SendToBack()
    $objForm.Controls.Add($checkBox)
}

[…]
$AllCustButton.Add_Click({ 
$selectedCusts = ???

})




Aucun commentaire:

Enregistrer un commentaire