• Advertisement
Sign in to follow this  

[.net] FolderBrowserDialog not working

This topic is 4595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
Your STA attribute seems to be ok.

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

Cheers

Share this post


Link to post
Share on other sites
Quote:

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

No, i am running locally on my PC.

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement