File explorer tool in Visual Studio?

c#, visual-studio, winforms

Solution

It's not that easy. You want the file open dialog. You would have to add a button, then in the handler for the button open the dialog.

OpenFileDialog fdlg = new OpenFileDialog();
if(fdlg.ShowDialog() == DialogResult.OK)
{
// do something here with fdlg.FileName ;
}

source

Problem

I have a C# project using windows forms. I need to let the user enter the location of a text file, so they will need some way to browse files and folders i.e. a button that opens a file explorer. What tool (in the toolbox) would this be in Visual Studio 2010? I tried DirectoryEntry and DirectorySearcher but that just adds something to the bottom like this:

Original source