Home All Groups Group Topic Archive Search About

Error opening FolderBrowserDialog

Author
4 Oct 2005 4:14 PM
Filipe Marcelino
Hi,

I'm having a little strange problem. When opening a FolderBrowserDialog
with the following instruction:

FolderBrowserDialog1.ShowDialog()

the following exception is thrown:

An unhandled exception of type 'System.InvalidCastException' occurred
in system.windows.forms.dll

Additional information: Unable to cast object of type
System.__ComObject to type IMalloc.


Can someone help me?



Regards,
Filipe Marcelino

Author
4 Oct 2005 7:07 PM
Gabriele G. Ponti
Are you setting some of the properties of the FolderBrowserDialog object to
invalid values?

As alternative, try to use PInvoke to call the SHBrowseForFolder() function:
http://www.pinvoke.net/default.aspx/shell32/SHBrowseForFolder.html

    Gabriele

AddThis Social Bookmark Button