Output is formatted differently after build

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 5 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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Output is formatted differently after build

Post by jvierra »

jvierra wrote: Tue Nov 14, 2017 9:36 am
CitrixITM wrote: Tue Nov 14, 2017 9:29 am Thanks, I did attempt to use out-string, but it had no effect. Below is my code. I'm surprised that it works fine in the Studio, but not fine once built. Is that normal?

$VMInfoFormated = $VMInfo | Format-Table -AutoSize | Out-String -Width 250
$textboxOutput.AppendText("$VMInfoFormated")
Do not use "AppendText". Use $textboxOutput.Lines as this will flow better.
User avatar
CitrixITM
Posts: 124
Last visit: Wed Jul 27, 2022 2:19 pm

Re: Output is formatted differently after build

Post by CitrixITM »

Yes, your example works fine. Mine doesn't. :)
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Output is formatted differently after build

Post by jvierra »

Check all properties on my listbox against you properties. Make your width 1000 to be sure.

You will have to troubleshoot this as we cannot run your system.
User avatar
CitrixITM
Posts: 124
Last visit: Wed Jul 27, 2022 2:19 pm

Re: Output is formatted differently after build

Post by CitrixITM »

Thank you! I found that there was an out-string somewhere else so I was doing it twice. Once I added the width to the first out-string, it worked fine.

Thank you,
Brian
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Output is formatted differently after build

Post by mxtrinidad »

Curious! Can you please provide the PowerShell Studio version?

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

Re: Output is formatted differently after build

Post by jvierra »

CitrixITM wrote: Tue Nov 14, 2017 11:03 am Thank you! I found that there was an out-string somewhere else so I was doing it twice. Once I added the width to the first out-string, it worked fine.

Thank you,
Brian
That happens. I do it to myself quite often. It is annoying and at times hard to find.
User avatar
CitrixITM
Posts: 124
Last visit: Wed Jul 27, 2022 2:19 pm

Re: Output is formatted differently after build

Post by CitrixITM »

I'm running PowerShell Studio 2017 5.4.145.0.

I understand now why I was getting the result that I got. I do not understand why it worked in Studio and then gave different output once built.
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: Output is formatted differently after build

Post by Alexander Riedel »

The host in PowerShell Studio has the width set to very wide to accommodate the width of the output window.
The packaged executable uses the default powershell settings.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 6 years and 5 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