Dynamically Adding Radio Buttons to a Form
by TomKemp at 2013-04-15 08:21:31
Can this be done please?
A colleague has a Script using Radio Buttons on a Form in Powershell.
He gathers data from a number of servers, producing a separate tabpage for each. This includes information about the disk drives on that server. Unfortunately, each server might have a different number of disk drives.
He wants to include a radio button for each drive, so that data for that drive can be displayed separately. Unfortunately, this requires a different number of radio buttons for each server.
I suggested a datagridview with buttons, but he is not keen to use this. Radio buttons would look better.
Is there any way to add radio buttons to the form – and to the groupbox – dynamically, according to the value of a variable at run time please?
by poshoholic at 2013-04-15 19:49:20
Hmmm. Radio buttons on dynamic forms means different potential size requirements, and while you can absolutely do that work programmatically, I don't think that's the best approach. The whole point of radio buttons is to choose just one. If you're choosing just one from an arbitrary number of possibilities, how about a combo box? It would be much easier and your form design would be static, simply displaying the disk drives in a dynamic list (the combo box contents).
You must be logged in to reply to this topic.