private void folder1_Click(object sender, EventArgs e)
{
FolderBrowserDialog diag = new FolderBrowserDialog();
if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
textBox1.Text = diag.SelectedPath;
}
else
{ textBox1.Text = "You didn't select the folder!"; }
}
private void file_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Title = "Select File";
openFileDialog1.InitialDirectory = @"C:\";//--"C:\\";
openFileDialog1.Filter = "All files (*.*)|*.*|Text File (*.txt)|*.txt";
openFileDialog1.FilterIndex = 2;
openFileDialog1.ShowDialog();
if (openFileDialog1.FileName != "")
{ textBox1.Text = openFileDialog1.FileName; }
else
{ textBox1.Text = "You didn't select the file!"; }
}
Download the project of Visual Studio 2013 in DropBox Download