FolderBrowserDialog won't open sometimes

R

Ray Mitchell

Hello,

I'm using VS2005 Pro & WinXP. I have the following code to open a
FolderBrowserDialog, with its initial path set to the directory specified by
"oldDirectoryName", which does exist.

FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
folderBrowserDialog.ShowNewFolderButton = allowCreateNewDirectory;
folderBrowserDialog.SelectedPath = oldDirectoryName;
DialogResult result = folderBrowserDialog.ShowDialog();
if (result == DialogResult.OK)
return folderBrowserDialog.SelectedPath;
return oldDirectoryName;

When the folderBrowserDialog.ShowDialog(); statement is executed sometimes
the dialog opens and works perfectly but a large percentage of the time it
never opens and my application just hangs until I kill it. I'm running in
the debug mode and I've tried stepping into that function but it will go no
farther and just hangs without showing me any more code. Any ideas?

Thanks,
Ray
 
S

Stefan Hoffmann

hi Ray,

Ray said:
When the folderBrowserDialog.ShowDialog(); statement is executed sometimes
the dialog opens and works perfectly but a large percentage of the time it
never opens and my application just hangs until I kill it. I'm running in
the debug mode and I've tried stepping into that function but it will go no
farther and just hangs without showing me any more code. Any ideas?
Sure? This dialog needs to enumerate folders first. When having a lot of
mapped and unreachable devices this may last its time...


mfG
--> stefan <--
 
R

Ray Mitchell

Stefan Hoffmann said:
hi Ray,


Sure? This dialog needs to enumerate folders first. When having a lot of
mapped and unreachable devices this may last its time...


mfG
--> stefan <--

Well, I gave it 30 minutes then killed it. If I open a new instance of
Windows Explorer it might take a few seconds to look at the sime directory
but never anywhere near 30 minutes. Of course maybe I'm comparing apples and
oranges here.
 
S

Stefan Hoffmann

hi Ray,

Ray said:
Well, I gave it 30 minutes then killed it. If I open a new instance of
Windows Explorer it might take a few seconds to look at the sime directory
but never anywhere near 30 minutes. Of course maybe I'm comparing apples and
oranges here.
Does it run well, when not being in debug mode. Thirty minutes is sure
too long.


mfG
--> stefan <--
 
G

G Himangi

Does your main function have the STAThread attribute. This is necessary for
it to work correctly.

---------
- G Himangi, LogicNP Software http://www.ssware.com
Shell MegaPack: GUI Controls For Drop-In Windows Explorer like File/Folder
Browsing Functionality (.Net & ActiveX Editions).
EZNamespaceExtensions: Develop namespace extensions rapidly in .Net and
MFC/ATL/C++
EZShellExtensions: Develop all shell extensions,explorer bars and BHOs
rapidly in .Net & MFC/ATL/C++
 
F

fyitang

Does your main function have the STAThread attribute. This is necessary for
it to work correctly.

---------
- G Himangi,   LogicNP Software      http://www.ssware.com
Shell MegaPack: GUI Controls For Drop-In Windows Explorer like File/Folder
Browsing Functionality (.Net & ActiveX Editions).
EZNamespaceExtensions: Develop namespace extensions rapidly in .Net and
MFC/ATL/C++
EZShellExtensions: Develop all shell extensions,explorer bars and BHOs
rapidly in .Net & MFC/ATL/C++

If there are too many files in some folder, or maybe too many sub
folders in a folder, windows explorer will hangs when open it. I guess
your suitation may be the same.
 
D

DH

fyitang said:
If there are too many files in some folder, or maybe too many sub
folders in a folder, windows explorer will hangs when open it. I guess
your suitation may be the same.
Hi Ray,
Have you tried running this in release and seeing if you get the same
problem.
(sorry if you have tried this just ran across this post)
DH
 

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