[.net] FolderBrowserDialog not working

Started by
5 comments, last by Jnz86 18 years, 9 months ago
Hi, i use the following code to ask user for folder:

FolderBrowserDialog* fb = new FolderBrowserDialog();
System::Windows::Forms::DialogResult res = fb->ShowDialog();

if (fb != DialogResult::OK)
   return;

And this is what i get: Well, as you can see it doesn't work. Maybe someone had similar problem ? And btw, i checked the msdn... [Edited by - Jnz86 on July 19, 2005 8:43:58 AM]
Advertisement
I remember seeing this before. It's a known bug.

Unfortuneately for you, I don't remember the whereabouts, but I'm sure you'll find the answer quite easily with google.

Regards,
jods
The Folderbrowser dialog is a very special dialog for two reasons:
1. It needs special security permissions. So if your code is not running under Full trust (use caspol.exe -rsg to find out about that) you might need to assign the file/folderbrowser permission to your app.
2. It is an ActiveX (COM) control that needs the [STAThread] attribute on the main thread. (Did you remove that???)

Cheers
Quote:
2. It is an ActiveX (COM) control that needs the [STAThread] attribute on the main thread. (Did you remove that???)


my WinMain looks like this:

System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;Application::Run(new ptIDE::FormIDE());


so if i understood well the STAThread attribute is OK, right? (Sorry I am new to .NET)

Quote:
1. It needs special security permissions. So if your code is not running under Full trust (use caspol.exe -rsg to find out about that) you might need to assign the file/folderbrowser permission to your app.

I need to check that...
Your STA attribute seems to be ok.

Are you running from a (mapped) network drive a share or something like that?

Cheers
Quote:
Are you running from a (mapped) network drive a share or something like that?

No, i am running locally on my PC.
Quote:
1. It needs special security permissions. So if your code is not running under Full trust (use caspol.exe -rsg to find out about that) you might need to assign the file/folderbrowser permission to your app.


Tell me more about it, maybe it's the problem...
Also, maybe you know some kind of link, or smthing which can help me :)

This topic is closed to new replies.

Advertisement