I’m currently experimenting and trying to get this code:
$processnames = Get-Process | select name
foreach ($processname in $processnames)
{
[void]$AD_list_current.Items.Add($processnames)
}
to output in a listbox. It outputs as it is but for some reason it keeps displaying in the listbox as:
Does anyone know why this is?
It would be greatly apprechiated.
Thank you
You are adding
$processnamesinstead of$processnameto your list.That’s an array.
As per Joey’s comment, the default
ToString()method will show the type name, which isSystem.Object.