FolderBrowserDialog crashing application

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
User avatar
gutihz
Posts: 38
Last visit: Fri Nov 10, 2023 10:54 am

FolderBrowserDialog crashing application

Post by gutihz »

Hi Everyone,

In my form I'm having the user select a folder and I get the folder path. When I run my application within the Sapien everything works. But when I build the app and run the executable on another computer everything works except the folder browser dialog. When I click on the button to open the folder browser dialog the application goes in to "not responding" mode.
I tried both "FolderBrowserDialog" and "FolderBrowserModernDialog" with same result.
I tried changing the build settings from V3 to V5 and V2with same result.

here is how I call it

Code: Select all

$btnopenfb_Click={
	
		if ([Void]$fb.ShowDialog() -eq 'OK')
		{
			$txtboxPaths.AppendText($fb.SelectedPath)
			$txtboxPaths.AppendText("`n")
		}
	}
Does anyone know if this is a bug or something?

Thanks in advance.


PowerShell Studio 2017 5.4.145
Version of product: 64
Operating system: Windows 7
OS: 64 bit
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: FolderBrowserDialog crashing application

Post by jvierra »

Be sure to build in STA mode.
User avatar
gutihz
Posts: 38
Last visit: Fri Nov 10, 2023 10:54 am

Re: FolderBrowserDialog crashing application

Post by gutihz »

YOU ARE A FREAKING GENIUS!!!!

I've always wondered how do you know all this s..t. I truly admire you!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: FolderBrowserDialog crashing application

Post by jvierra »

I have been a developer for more than 30 years and have studied Windows and most other operating systems extensively at the internals level. The stuff just accumulates. I also use a lot of PowerShell and have read all of the current advanced books on PS and continue to refer to them when I am in doubt.

Anyone who puts in sufficient effort can get to where I am and many have gone way past me. Today I meet young programmers out of college for only a couple of years that are way advanced and moving at high speed. They grab new technologies even faster than I can.

All of this is based on your level of interest, curiosity and sweat.
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