Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

FolderBrowserDialog not showing folders

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eric - 02 Apr 2004 08:29 GMT
Hi,

I have created an application compiled with .NET 1.0. Since no folder dialog
was avialable i used an external library. Now that i'm using  the .NET
framework 1.1 i removed the external library and used the
FolderBrowserDialog object. When a button is pressed i execute this code:

FolderBrowserDialog fbd = new FolderBrowserDialog ();
fbd.ShowDialog();

A Folder dialog is showed but i can't see any folders. The only thing i see
are the buttons OK & Cancel (and create new folder button when the
ShowNewFolderButton properyty is set to true). When i try the exact same
code on a different form everything is working fine. Any ideas??

Eric
Peter Aragon - 02 Apr 2004 16:28 GMT
Hi Eric

Are you using it from a form class?
If you use it straight from a class without a Hwnd then you will get that
kind of behaviour. Test is by adding a form, with a button, and put that
code in the onclick. You will see the folders now.

Good luck,
Peter

> Hi,
>
[quoted text clipped - 12 lines]
>
> Eric
DotNetJunkies User - 12 Apr 2004 19:46 GMT
I'm experiencing a similar issue.  A simple form program calling FolderBrowserDialog() works fine.  However, when using the code in a larger program, no folders are displayed - only an empty dialog with <OK><Cancel> and <New Folder> buttons.

In both programs, the FolderBrowserDialog() is called by pressing a button on a form.

Any progress in finding a solution?

-Mark Falconer

---
Herfried K. Wagner [MVP] - 12 Apr 2004 20:41 GMT
* DotNetJunkies User <User@-NOSPAM-DotNetJunkies.com> scripsit:
> I'm experiencing a similar issue.  A simple form program calling FolderBrowserDialog() works fine.  However, when using the code in a larger program, no folders are displayed - only an empty dialog with <OK><Cancel> and <New Folder> buttons.
>
> In both programs, the FolderBrowserDialog() is called by pressing a button on a form.
>
> Any progress in finding a solution?

Are you sure your 'Sub Main' or 'void Main' is marked with the
'STAThread' attribute and not with the 'MTAThread' attribute?

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/

DotNetJunkies User - 12 Apr 2004 22:47 GMT
Specifying the threading model does not appear to make a difference.  The simple code using FolderBrowserDialog() works with either [STAThread] or [MTAThread].  The larger program does not display files in the FolderBrowserDialog with either [STAThread] or [MTAThread].

-Mark Falconer

---
Herfried K. Wagner [MVP] - 12 Apr 2004 23:14 GMT
Mark,

* DotNetJunkies User <User@-NOSPAM-DotNetJunkies.com> scripsit:
> Specifying the threading model does not appear to make a difference.  The simple code using FolderBrowserDialog() works with either [STAThread] or [MTAThread].  The larger program does not display files in the FolderBrowserDialog with either [STAThread] or [MTAThread].

On my Windows XP Professional machine + .NET 1.1, specifying 'MTAThread'
prevents the folder selection control from showing.  Are you using any
COM/ActiveX controls in your project?  Do you see the folder selection
tree?

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/

DotNetJunkies User - 13 Apr 2004 18:23 GMT
Herfried,

I've made some progress, but first to answer your questions:
1) The project uses a few Windows Forms Controls (Button, CheckBox, ComboBox, GroupBox, Label, ProgressBar, RadioButton, and StatusBar).  I don't know if these contain ActiveX/COM technology.
2) When the FolderBrowserDialog 'fails', the folder selection tree is not visible.

I found the FolderBrowerDialog component works if the runtime library for linking is changed!  Multi-threaded Debug (/MTd) does not work.  Multi-threaded DLL (/MD or /MDd) does work!

Does this make sense?

Aside: Single-threaded (/ML or /MLd) runtime libraries cause a command line error ('/ML' and 'clr' options incompatible); and, the multi-threaded runtime library (/MT) causes several link errors.

Thanks much for your help.

Sincerely,

Mark Falconer

---
Chris Lomont - 01 May 2004 17:35 GMT
I have the same problems. Changing the link type fixed it also. This is
strange.

I am using Win XP corp, .NET 1.1, VS C++ 7.1 (2003).

Chris Lomont

> Herfried,
>
> I've made some progress, but first to answer your questions:
> 1) The project uses a few Windows Forms Controls (Button, CheckBox, ComboBox, GroupBox, Label, ProgressBar, RadioButton, and StatusBar).  I
don't know if these contain ActiveX/COM technology.
> 2) When the FolderBrowserDialog 'fails', the folder selection tree is not visible.
>
> I found the FolderBrowerDialog component works if the runtime library for linking is changed!  Multi-threaded Debug (/MTd) does not work.
Multi-threaded DLL (/MD or /MDd) does work!

> Does this make sense?
>
> Aside: Single-threaded (/ML or /MLd) runtime libraries cause a command line error ('/ML' and 'clr' options incompatible); and, the multi-threaded
runtime library (/MT) causes several link errors.

> Thanks much for your help.
>
[quoted text clipped - 5 lines]
>
>  Our newsgroup
engine supports Post Alerts, Ratings, and Searching.
Ken - 30 Dec 2004 00:49 GMT
I experienced the same problem running on Windows 2003 Server Standard.
Explicitly defining the STAThread attribute in the void Main seems to
have solved the problem for me.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.