Q:

How Can I get path folder browser dialog

I got some problem with thread and I need get path from folder browser dialog
here is a code
Thread t = new Thread(() => myFolderBrowserDialog.ShowDialog());
                    t.IsBackground = true;
                    t.SetApartmentState(ApartmentState.STA);
                    t.Start();

A:

You could do this:
Thread t = new Thread(() => myFolderBrowserDialog.ShowDialog());
t.IsBackground = true;
t.SetApartmentState(ApartmentState.STA);
t.Start();
t.Join();

var path = myFolderBrowserDialog.SelectedPath;

But there is really zero point in the thread, it achives the same as this:
myFolderBrowserDialog.ShowDialog();  //this will block until the user presses OK or cancel.
var path = myFolderBrowserDialog.SelectedPath;

Personally, I would do this:
Using (var dialog = new FolderBrowserDialog())
{
    //setup here

    if (dialog.ShowDialog() == DialogResult.Ok)  //check for OK...they might press cancel, so don't do anything if they did.
    {
         var path = dialog.SelectedPath;    
         //do something with path
    }
}

