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.
Locked
User avatar
LtMandella
Posts: 61
Joined: Fri Feb 12, 2016 5:32 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: 14480
Joined: Tue May 22, 2007 9:57 am
Contact:

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.

Locked