Wildcard GUI commands?

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Brendan440
Posts: 5
Last visit: Mon Jan 29, 2024 5:09 am

Wildcard GUI commands?

Post by Brendan440 »

I have a GUI I am working on that has a ton of fields that get a small green checkmark to appear next to them if the value in them is correct. However when I change the dropdown value, I would like to hide all the icons until the code below them runs and determines if they are needed. Or hides them all if the user changes the dropdown. So I have a ton of these

$picturebox1.Visible = $false

At the start of the dropdown change code. Is there a way to do a "$picturebox*.Visible = $false" type of command? Unfortunately, the $picturebox variable has some letters at the end of it to designate all the different variables, so I can't have it just walk through 1...20 to make the changes in a loop. Though I suppose if thats the only answer, I could, I just hate such generic named variables.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Wildcard GUI commands?

Post by jvierra »

In the controls collection you can filter on the "PictureBox" control type, and they will be returned as a collection.

You can also put all of the PB controls in a group box and just enumerate the controls collection of the GB.
This topic is 1 year and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked