Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

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 3 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
peter@doxadvisors.com
Posts: 2
Last visit: Sun Jan 06, 2019 7:29 am

Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by peter@doxadvisors.com »

Code that worked perfectly on Windows 7 and Windows server 2012 R2 does not work on Windows 10.

I have a FolderBrowserDialog button but clicking it does nothing on Windows 10.

Is there another way to browse for a folder that works in Windows 10?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by jvierra »

Works fine for me on all versions of Windows.

Here is an example.
Attachments
Test-Folder rowserDialog.psf
(30.17 KiB) Downloaded 100 times
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by davidc »

Make sure you are running the script in STA mode otherwise the dialog will not appear.
David
SAPIEN Technologies, Inc.
User avatar
peter@doxadvisors.com
Posts: 2
Last visit: Sun Jan 06, 2019 7:29 am

Re: Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by peter@doxadvisors.com »

Thanks for the quick response and sample code.

It is indeed now working on a Windows 10 Environment. I just have to test on the client machine that it was not working on.

Glad to have the reassurance that it does indeed work on Windows 10.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by jvierra »

Glad to hear you have the answer. Some controls do require STA only which is the default but it is easy to change it accidentally.
This topic is 5 years and 3 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