.net - Copy all Listbox items to a array -
i have listbox contains psobjects this:
$obj = new-object -typename psobject -property @{ 'name' = 'sueanne' 'region'= 'northern' } the listbox looks (i set $listbox.displaymember = 'name'):
|sueanne | |marge | |rocky | none of listbox items selected , need able copy listbox items array. works if listbox items selected
$templist = $listbox.selecteditems write-host $templist[0..1] #output first 2 items @{name=sueanne; region=northern} @{name=marge; region=southern}
but since aren't selected there way without looping through each item in listbox?
pretty sure looking listbox.items
this property enables obtain reference list of items stored in listbox.
so in case array looking comes $listbox.items.
Comments
Post a Comment