FolderBrowserDialog not showing folders

E

Eric

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
 
P

Peter Aragon

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
 
D

DotNetJunkies User

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
 
H

Herfried K. Wagner [MVP]

* DotNetJunkies User said:
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?
 
D

DotNetJunkies User

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
 
H

Herfried K. Wagner [MVP]

Mark,

* DotNetJunkies User said:
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?
 
D

DotNetJunkies User

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
 
C

Chris Lomont

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


DotNetJunkies User said:
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
engine supports Post Alerts, Ratings, and Searching.
 
K

Ken

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top