Home All Groups Group Topic Archive Search About

FolderBrowserDialog won't open sometimes

Author
14 Dec 2008 7:49 PM
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

Author
14 Dec 2008 8:08 PM
Stefan Hoffmann
hi Ray,

Ray Mitchell wrote:
> 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 <--
Are all your drivers up to date? click for free checkup

Author
14 Dec 2008 9:28 PM
Ray Mitchell
Show quote Hide quote
"Stefan Hoffmann" wrote:

> hi Ray,
>
> Ray Mitchell wrote:
> > 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 <--
>

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.
Author
15 Dec 2008 9:39 AM
Stefan Hoffmann
hi Ray,

Ray Mitchell wrote:
> 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 <--
Author
15 Dec 2008 10:07 AM
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++
---------

Show quoteHide quote
"Ray Mitchell" <RayMitchell_NOSPAM_@MeanOldTeacher.com> wrote in message
news:0A6D2D05-CAE0-442D-8718-CED72192AC1C@microsoft.com...
> 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
>
Author
17 Dec 2008 1:56 AM
fyitang
Show quote Hide quote
On Dec 15, 6:07 pm, "G Himangi" <nos...@nospam.com> wrote:
> 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++
> ---------
>
> "Ray Mitchell" <RayMitchell_NOSP***@MeanOldTeacher.com> wrote in message
>
> news:0A6D2D05-CAE0-442D-8718-CED72192AC1C@microsoft.com...
>
> > 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

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.
Author
17 Dec 2008 4:24 PM
DH
fyitang wrote:
Show quoteHide quote
> On Dec 15, 6:07 pm, "G Himangi" <nos...@nospam.com> wrote:
>> 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++
>> ---------
>>
>> "Ray Mitchell" <RayMitchell_NOSP***@MeanOldTeacher.com> wrote in message
>>
>> news:0A6D2D05-CAE0-442D-8718-CED72192AC1C@microsoft.com...
>>
>>> 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
>
> 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

Bookmark and Share