I am trying to set the selected folder in a FolderBrowserDialog control as a variable, so I can use it within another method
The code I have so far is:
private void button18_Click(object sender, EventArgs e)
{
DialogResult result = folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
//
// The user selected a folder and pressed the OK button.
// We print the number of files found.
//
string[] files = Directory.GetFiles(folderBrowserDialog1.SelectedPath);
MessageBox.Show("Files found: " + files.Length.ToString(), "Message");
}
}
So I could call the selected folder in the control above in a method like this:
Process.Start("test.exe", <Folder Selection Here> );
I started looking at this before I noticed that you had requested the question to be closed. Anyway here’s the code should it be useful for someone else.