Hi,
Per my test, the return value of the function is of type Object[], not BindingSource. To keep value type you can prepend a comma to $B.
FUNCTION fun
{
param ($D)
$B = New-Object System.Windows.Forms.BindingSource
$B.DataSource = $D
return ,$B
}
$Bs = fun -D $data
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.