Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Dynamic Variables and New-Object - in a GUI

$
0
0

so, i have not found anything that i can parlay into a solution for what i am attempting to do.  

Basically i am using powershell to build a GUI to manage websites on various servers.  

in a nutshell:

- i have an array with the servers i want to query

- a foreach loop gets me the site names for each server (number of sites can vary on a server).

- need put checkboxes on a GUI for every site to do something (25-30 sites across 8 servers).

currently i am passing the $dir.name variable to a function that will create the new variable using this command:

$pName = $dir.name 

New-variable -name $pName -value (New-Object System.Windows.Forms.CheckBox)
$pName.Location -value (New-Object System.Drawing.Size(10,$i))
$pName.Size -value (New-Object System.Drawing.Size(100,20))
$Pname.Text -value $dir.name
$groupBox.Controls.Add($pName) 

Problem is i am not able to do anything with my newly created variable.  I am trying to use the following code to position the new checkbox but i get nothing (same for text, size, etc.)  I am not seeing any errors, so i don't know what i have going wrong.  

is this even possible?

I am able to create static checkboxes, and i can create dynamic variables.  But i can't mix the two...


Viewing all articles
Browse latest Browse all 15028

Trending Articles