splash screen doesn't display label text

hi all,

I cannot understand why the label is blank when I run this small piece of code. Can someone please explain to me what I’m doing wrong?

thanks!

$formSplashScreen_Load = {

Show-SplashScreen

}

function Show-SplashScreen
{
[OutputType([System.Windows.Forms.Form])]

$splashForm = New-Object System.Windows.Forms.Form
$splashForm.AutoScaleDimensions = '6, 13'
$splashForm.AutoScaleMode = 'Font'
$splashForm.ClientSize = '312, 134'

$label1 = New-Object System.Windows.Forms.label
$splashForm.Controls.Add($label1)
$label1.AutoSize = $false
$label1.Size = '260, 50'
$label1.Location = '20,10'
$label1.ForeColor = 'Black'
$label1.BackColor = 'White'
$label1.Font = 'Microsoft Sans Serif, 9.75pt, style=Bold'
$label1.Text = 'Scanning for all PST Files, please wait...'

$splashForm.Text = 'Scanning...'
$splashForm.FormBorderStyle = 'FixedDialog'

$splashForm.ControlBox = $false
$splashForm.StartPosition = 'CenterScreen'
$splashForm.TopMost = $true

$splashForm.Show()

Get-ChildItem -Path c:\Windows\System32 -Recurse
$splashForm.close()

}

Hello,

Add controls after you set the properties, move line # 17 to 24, hopefully it will work.

Thank you.