Attempting to import .csv cell contents into a PowerShell Form Combo/Drop Down Box which works when I hard code in each variable number ($DropDownBox1.Text, $DropDownBox2.Text etc.) but was looking to make it a bit smarter and loop through each instance and import appropriately.
Is it possible to modify the left hand assignment to get it to increment accordingly?
$i=0
$x=1
Foreach($User in $ISDept)
{
$DropDownBox[$x].Text = Import-Csv -Path $File | Select-object -Index ($i) |% {$_.Status}
$i++
$x++
}
Using the above code I get the error:
"Unable to index into an object of type System.Windows.Forms.ComboBox."
Thanks in advance.