How to make FolderBrowserDialog TopMost window.
-
I have 'Form1' and 'Form2'. Form1 opens up Form2 and Form2 brings up a FolderBrowserDialog (called m_MyBrowser). For the folder strucure to show properly in fbd I have to open this dialog on a different thread like this:
Thread aThread = new Thread(new ThreadStart(ShowFolderBrowser));
aThread.SetApartmentState(ApartmentState.STA);
aThread.Start();private void ShowFolderBrowser()
{
m_MyBrowser.SelectedPath = string.Empty;
if (m_MyBrowser.ShowDialog() == DialogResult.Cancel)
return;
else
txtBxLocation.Text = m_MyBrowser.SelectedPath;
}My problem is that I want the m_MyBrowser to be modal and top most (relative to Form2), but since I had to open it in another thread I can't get it to work by simply calling the
ShowDialog()
method. Does anyone here have any ideas on how to get it modal? -
I have 'Form1' and 'Form2'. Form1 opens up Form2 and Form2 brings up a FolderBrowserDialog (called m_MyBrowser). For the folder strucure to show properly in fbd I have to open this dialog on a different thread like this:
Thread aThread = new Thread(new ThreadStart(ShowFolderBrowser));
aThread.SetApartmentState(ApartmentState.STA);
aThread.Start();private void ShowFolderBrowser()
{
m_MyBrowser.SelectedPath = string.Empty;
if (m_MyBrowser.ShowDialog() == DialogResult.Cancel)
return;
else
txtBxLocation.Text = m_MyBrowser.SelectedPath;
}My problem is that I want the m_MyBrowser to be modal and top most (relative to Form2), but since I had to open it in another thread I can't get it to work by simply calling the
ShowDialog()
method. Does anyone here have any ideas on how to get it modal?