dynamic controls on winforms

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 6 years and 11 months 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
LtMandella
Posts: 61
Last visit: Mon May 07, 2018 4:03 pm

dynamic controls on winforms

Post by LtMandella »

Hi,
I am contemplating converting a winform app I wrote a few years ago that is about 90% dynamic controls into powershell.

We persist custom metadata (parameters, data types, output columns, etc.) for numerous "report only" stored procs, and I built one winform that reads the metadata at runtime and dynamically add the controls to enter that proc's parameters , choose which columns to return, runs the proc, and displays results to a grid on the same form.

For us, it beat the heck out of maintaining dozens of separate forms or SSRS reports for executing the queries.

Anyone been successful at dynamic winform controls using PShell Studio?

If so, were there any stumbling blocks that limited what could be done vs. C#? We don't need MDI interface.

thanks,
Ken
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: dynamic controls on winforms

Post by jvierra »

Yes and it works just like it does in C++, C# or any other Net language. We load and populate the form from a persisted database record of the form and from dynamically arranged controls generated by reading a record and using dynamic flow to create and bind the controls.

Here is a simple - stand alone - example of this: http://tech-comments.blogspot.com/2017/ ... forms.html

The pop-up child form is dynamically generated from a database record. It can be made even more dynamic since almost all properties of a control can be data bound to almost any data source.
This topic is 6 years and 11 months 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