all groups > dotnet windows forms > april 2008 >
You're in the

dotnet windows forms

group:

NullReferenceException from FolderBrowserDialog


NullReferenceException from FolderBrowserDialog ondrej421
4/22/2008 4:53:00 PM
dotnet windows forms:
Hi there,

My application, which uses the FolderBrowserDialog, sometimes throws a
NullReferenceException with the following call stack when calling
FolderBrowserDialog.ShowDialog():

at
System.Windows.Forms.UnsafeNativeMethods.Shell32.SHBrowseForFolder(BROWSEINFO
lpbi)
at System.Windows.Forms.FolderBrowserDialog.RunDialog(IntPtr hWndOwner)
at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
...

Any ideas what could be causing this?

Re: NullReferenceException from FolderBrowserDialog Scott M.
4/22/2008 8:29:05 PM
It is most likely caused when no file is selected and the OK button is
pressed or when the cancel button is pressed. You must code for these two
possibilities.

-Scott

[quoted text, click to view]

AddThis Social Bookmark Button