Windows Develop Bookmark and Share   
 index > Windows Forms General > FolderBrowserDialog hangs after selecting a folder
 

FolderBrowserDialog hangs after selecting a folder

This is a baffling problem that I hope someone might have an idea about...

I've got an discontinued open source program that is pretty straightforward...the problem is that it has two FolderBrowserDialog items to select folders from in parts of the app.

Now, opening the FBD works fine, and browsing the folder structure is fine. When you click a folder name and then hit "OK" the entire application hangs with no error (even in debug mode) and no indication of what it is doing or hanging on. Both FBD instances are very straightforward and work fine on other computers that have been running the app for literally years. An example of one of the two locations of the FBD is as follows:

private void buttonBrowse_Click(object sender, System.EventArgs e)
		{
			FolderBrowserDialog dialog = new FolderBrowserDialog();
			dialog.ShowNewFolderButton = true;
			
			DialogResult result = dialog.ShowDialog();
			if (result != DialogResult.OK)
				return;			
			
			
			textBoxPath.Text = dialog.SelectedPath;
		}
It seems to be something to do with the system since it works elsewhere, but does anyone have ideas on what could possibly cause the FBD to hang like this?
Kettch19  Tuesday, August 18, 2009 9:19 PM
I guess it's worth trying a repair/reinstallation of the .NET framework.
http://blog.voidnish.com
  • Marked As Answer byKettch19 Wednesday, August 19, 2009 3:09 PM
  •  
Nishant Sivakumar  Wednesday, August 19, 2009 2:16 PM
Can you try creating a quick and small C++ app that calls SHBrowseForFolder? That way you can verify if it's a .NET framework installation issue.
http://blog.voidnish.com
Nishant Sivakumar  Tuesday, August 18, 2009 9:30 PM
I've created a very simple brand new VB solution that just has a button and textbox that calls the FBD and the same issue occurs. Give me a bit to try the C++ SHBrowseForFolder.
Kettch19  Tuesday, August 18, 2009 9:42 PM
Just out of curiosity, when you open Windows Explorer, does the same kind of freezing happen?
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki �Twitter �LinkedIn �ForumsBrowser
David M Morton  Tuesday, August 18, 2009 9:43 PM
Just out of curiosity, when you open Windows Explorer, does the same kind of freezing happen?
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki �Twitter �LinkedIn �ForumsBrowser

Nope, and other applications that have folder selections do not hang, but who knows if they use the runtimes or not.
Kettch19  Tuesday, August 18, 2009 9:47 PM
A simple VC++ app that calls SHBrowseForFolder does not hang at all and behaves as expected. It does not work with brand new and simple VB or C# projects. Is something mucked up in the runtimes?
Kettch19  Tuesday, August 18, 2009 10:38 PM
Seems like it's the .NET libraries that seem to be at fault here - what version are you on? Its not 1.1, is it?
http://blog.voidnish.com
Nishant Sivakumar  Wednesday, August 19, 2009 1:15 AM
I've got 1.1, 2.0, 3.0, and 3.5 installed on this system. All of the sample apps that are not working are compiled to 2.0.
Kettch19  Wednesday, August 19, 2009 1:53 PM
I've got 1.1, 2.0, 3.0, and 3.5 installed on this system. All of the sample apps that are not working are compiled to 2.0.

Long shot here but try making a 3.0 or 3.5 build to see if that works. It'll help determine if it's just one version that's messed up.
http://blog.voidnish.com
Nishant Sivakumar  Wednesday, August 19, 2009 2:07 PM
3.0 and 3.5 builds exhibit the same hang/crash issue as the 2.0 builds, I just tried both VB and C# versions of the sample apps I made for testing this.
Kettch19  Wednesday, August 19, 2009 2:12 PM
I guess it's worth trying a repair/reinstallation of the .NET framework.
http://blog.voidnish.com
  • Marked As Answer byKettch19 Wednesday, August 19, 2009 3:09 PM
  •  
Nishant Sivakumar  Wednesday, August 19, 2009 2:16 PM
After running a repair, the sample apps I made for testing now work, but the original app that had the problem still does not, which is quite strange. I suppose I will have to try a complete manual uninstall then reinstall from scratch and see if that changes the behavior. Any other ideas?
Kettch19  Wednesday, August 19, 2009 2:57 PM
Did you do a full rebuild of the original app?
http://blog.voidnish.com
Nishant Sivakumar  Wednesday, August 19, 2009 3:00 PM
Actually, I just did a full clean and rebuild and as you suggested, it now works. Excellent!

Thanks for helping me confirm the obvious answer! :)
Kettch19  Wednesday, August 19, 2009 3:09 PM

You can use google to search for other answers

Custom Search

More Threads

• Can I add an outlook calendar?
• How can I detect Acrobat Reader ?
• Difference between Mainmenu and MenuStrip (VS 2003 and 2005)
• passing a combobox as a parameter to another routine
• MenuStrip
• Forms Inheritance (Design Mode): Field Not Found -- Why?
• Right Click on the System Tray Icon
• MDI that looks like vb.net studio or photoshop
• Problem with disable the "close" buttons
• What are the keycodes for these?