Need to create, use and store dynamic object names in Powershell
Need to create, use and store dynamic object names in Powershell I am loading in a text file and looping through each line, and trying to print a checkbox, in a powershell form. However, the way below, all checkboxes have the same variable/object name, which makes it impossible to tell them apart. I need a way to dynamically create $checkbox0 through $checkbox(# of lines in text file, which can change), and fill them in below, as well as store the names, so i can validate if they are clicked later $pFile = Get-Content "C:results.txt" $rowCounter = 0 foreach($line in $pFile){ $checkbox = New-Object System.Windows.Forms.CheckBox $checkbox.UseVisualStyleBackColor = $True $System_Drawing_Size = New-Object System.Drawing.Size $checkbox.AutoSize = "true" $checkbox.TabIndex = $rowCounter $checkbox.Text = $line $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 25 $yValue = (20 * $rowCounter) $System_Dra...