printing the gui form

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 5 years and 2 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
patgn3
Posts: 6
Last visit: Thu Jan 05, 2023 10:59 am

printing the gui form

Post by patgn3 »

Product, version and build: studio 2012, v. 3.1.35
32 or 64 bit version of product: 64 bit
Operating system: windows 7
32 or 64 bit OS: 64 bit

Printing. I created a gui (form) that has three columns that users input the items weights. it then does an average calculation and a standard deviation calculation. we compile the script into an executable. However, they require the results (their input included) needs to be printed for their logs.
any help or ideas are greatly appreciated.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: printing the gui form

Post by davidc »

[TOPIC MOVED TO POWERSHELL GUI FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: printing the gui form

Post by davidc »

I recommend looking at the Out-Printer cmdlet. You will have to format and pipe the data to the cmdlet.
David
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: printing the gui form

Post by jvierra »

You can also export the data from the grid to a file. THe CSV can be easily printed by calling:

Start-Process <file.csv> -verb Print

See the attached example.
Attachments
Demo-DGVExport3.psf
(17.35 KiB) Downloaded 96 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: printing the gui form

Post by jvierra »

Another method of printing is to use the "Document Print" classes.

See attached.
Attachments
Demo-PrintDocument2.psf
(16.66 KiB) Downloaded 103 times
This topic is 5 years and 2 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