Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to allow a user to browse for a file in C#?

Tags:

c#

What's the best way to allow a user to browse for a file in C#?

like image 902
Fred Avatar asked Aug 27 '08 19:08

Fred


1 Answers

using (OpenFileDialog dlg = new OpenFileDialog())
{
    dlg.Title = "Select a file";
    if (dlg.ShowDialog()== DialogResult.OK)
    {
        //do something with dlg.FileName  
    }
}
like image 143
Ryan Farley Avatar answered Sep 18 '22 11:09

Ryan Farley