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.
Locked
User avatar
boyddt_co
Posts: 75
Joined: Mon Dec 17, 2007 5:50 am

Forms on the fly

Post by boyddt_co » Wed Apr 02, 2014 3:00 pm

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 1488 times

User avatar
jvierra
Posts: 13793
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Forms on the fly

Post by jvierra » Wed Apr 02, 2014 3:30 pm

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: 75
Joined: Mon Dec 17, 2007 5:50 am

Re: Forms on the fly

Post by boyddt_co » Thu Apr 03, 2014 2:49 pm

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.

User avatar
jvierra
Posts: 13793
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Forms on the fly

Post by jvierra » Thu Apr 03, 2014 3:23 pm

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.

Locked