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.
Locked
User avatar
peter@doxadvisors.com
Posts: 2
Joined: Mon Apr 10, 2017 6:09 am

Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by peter@doxadvisors.com » Wed Nov 28, 2018 8:13 pm

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?

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

Re: Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by jvierra » Wed Nov 28, 2018 8:19 pm

Works fine for me on all versions of Windows.

Here is an example.
Attachments
Test-Folder rowserDialog.psf
(30.17 KiB) Downloaded 19 times

User avatar
davidc
Posts: 5810
Joined: Thu Aug 18, 2011 4:56 am

Re: Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by davidc » Thu Nov 29, 2018 8:25 am

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
Joined: Mon Apr 10, 2017 6:09 am

Re: Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by peter@doxadvisors.com » Fri Nov 30, 2018 3:58 pm

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.

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

Re: Windows 10 FolderBrowserDialog and FolderBrowserModernDialog not working

Post by jvierra » Fri Nov 30, 2018 5:36 pm

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.

Locked