Forms on the fly

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 9 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
boyddt_co
Posts: 89
Last visit: Mon Sep 25, 2023 9:36 pm

Forms on the fly

Post by boyddt_co »

I originally posted this in the PrimalForms forum an they directed me here.

I have a project that I'm working on whose output is going to vary depending on the operator using it. Basically it is a table with 7 columns and x number of rows - with the rows being dependent on the number of machines in a cell. The row count could be anywhere from 1 to 12. As I query data from SQL I'd like to custom build the form at run-time so that I'm only showing a table big enough to hold the data.

If I can't have the form built dynamically, can I have multiple forms, one for each of the twelve possibilities and call the form based on the number of machines in the cell?

I'm including a screen shot of a mock-up in Excel to better illustrate my desired outcome. This mock-up would be all the machines in one cell.

Thanx in advance,

David

Sample.png
Sample.png (70.34 KiB) Viewed 2488 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Forms on the fly

Post by jvierra »

The DataGrid control is dynamic. It can take a datatable and automatically adjust to the available data.

What else could be better.
User avatar
boyddt_co
Posts: 89
Last visit: Mon Sep 25, 2023 9:36 pm

Re: Forms on the fly

Post by boyddt_co »

Ok, so the datagrid view is dynamic, is it interactive? What I would need to do is to allow an operator tap on a cell when the product goes into production. This would change the appearance to show that it is in process. A second tap would allow the operator to change the appearance again to denote that it is finished. Can we do that with the data grid?

Thanx in advance.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Forms on the fly

Post by jvierra »

That is what the DataGrid and DataGridView controls do.

Take some time to review the blog posts on how to design Forms. You will see that this is all very easy once you know the basics.

http://www.sapien.com/blog/topics/user- ... istrators/

Once you know how the eventing model of Windows is used in forms and how to set up and navigate your controls forms design and implementation becomes fairly easy.
This topic is 9 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