GUI HELP, Dialog will not close,

All,

i have used POSHGUI in the past to make an interface for my PS, just created one yesterday, and for some reason when the dialog open, it goes into a "running" state, and i cant close it, nor can i select any of the objects,  just started the code so it isnt doing anything except populating the list box and text box items,

Any ideas why this is is happening,


Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()

$frmAddUser2ConnectedProject = New-Object system.Windows.Forms.Form
$frmAddUser2ConnectedProject.ClientSize = New-Object System.Drawing.Point(400,400)
$frmAddUser2ConnectedProject.text = "Add Users to Connected Project"
$frmAddUser2ConnectedProject.TopMost = $false

$txtBoxDatasource = New-Object system.Windows.Forms.TextBox
$txtBoxDatasource.multiline = $false
$txtBoxDatasource.width = 385
$txtBoxDatasource.height = 20
$txtBoxDatasource.location = New-Object System.Drawing.Point(0,35)
$txtBoxDatasource.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$lblDatasource = New-Object system.Windows.Forms.Label
$lblDatasource.text = "Datasource logged Into"
$lblDatasource.AutoSize = $true
$lblDatasource.width = 25
$lblDatasource.height = 10
$lblDatasource.location = New-Object System.Drawing.Point(10,12)
$lblDatasource.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$lblWorkAreasConnected = New-Object system.Windows.Forms.Label
$lblWorkAreasConnected.text = "Work Areas Connected Projects"
$lblWorkAreasConnected.AutoSize = $true
$lblWorkAreasConnected.width = 25
$lblWorkAreasConnected.height = 10
$lblWorkAreasConnected.location = New-Object System.Drawing.Point(6,77)
$lblWorkAreasConnected.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$lstBoxConnProjects = New-Object system.Windows.Forms.ListBox
$lstBoxConnProjects.text = "listBox"
$lstBoxConnProjects.width = 252
$lstBoxConnProjects.height = 208
$lstBoxConnProjects.location = New-Object System.Drawing.Point(3,100)

$lblNoUsers = New-Object system.Windows.Forms.Label
$lblNoUsers.text = "No. Wood Users"
$lblNoUsers.AutoSize = $true
$lblNoUsers.width = 25
$lblNoUsers.height = 10
$lblNoUsers.location = New-Object System.Drawing.Point(275,77)
$lblNoUsers.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$txtNoWoodUser = New-Object system.Windows.Forms.TextBox
$txtNoWoodUser.multiline = $false
$txtNoWoodUser.width = 100
$txtNoWoodUser.height = 20
$txtNoWoodUser.location = New-Object System.Drawing.Point(271,100)
$txtNoWoodUser.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$btnAddUsers = New-Object system.Windows.Forms.Button
$btnAddUsers.text = "Add Users"
$btnAddUsers.width = 60
$btnAddUsers.height = 30
$btnAddUsers.location = New-Object System.Drawing.Point(64,343)
$btnAddUsers.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$btnExit = New-Object system.Windows.Forms.Button
$btnExit.text = "Exit"
$btnExit.width = 60
$btnExit.height = 30
$btnExit.location = New-Object System.Drawing.Point(242,343)
$btnExit.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$frmAddUser2ConnectedProject.controls.AddRange(@($txtBoxDatasource,$lblDatasource,$lblWorkAreasConnected,$lstBoxConnProjects,$lblNoUsers,$txtNoWoodUser,$btnAddUsers,$btnExit))


#> all code starts here after, then open the form

#>

#log into the datasource
New-PWLogin

$DataSource = Get-PWCurrentDatasource -Verbose

#Add this to the txtboxdatasource
$txtBoxDatasource.Text = $DataSource

#Now lets populate the list box with the work areas that are actually connected
$connrps = Get-PWRichProjects -PopulateProjectProperties -PopulatePaths -OnlyConnectedProjects
#foreach rich project, get the Connected Project ID
foreach ($crp in $connrps)
{
write-host $rp
$lstBoxConnProjects.Items.add($crp.Name)

}

$frmAddUser2ConnectedProject.Show()