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

[{'answer_id': 31036, 'author': 'Ryan Farley', 'author_id': 1627, 'author_profile': 'https://Stackoverflow.com/users/1627', 'pm_score': 5, 'selected': True, 'text': '<pre><code>using (OpenFileDialog dlg = new OpenFileDialog())\n{\n    dlg.Title = "Select a file";\n    if (dlg.ShowDialog()== DialogResult.OK)\n    {\n        //do something with dlg.FileName  \n    }\n}\n</code></pre>\n'}, {'answer_id': 31039, 'author': 'Rob Cooper', 'author_id': 832, 'author_profile': 'https://Stackoverflow.com/users/832', 'pm_score': 1, 'selected': False, 'text': '<p>I would say use the standard "Open File" dialog box (<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx" rel="nofollow noreferrer">OpenFileDialog</a>), this makes it less intimidating for new users and helps with a consistant UI.</p>\n'}, {'answer_id': 31040, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': 1, 'selected': False, 'text': '<p>Close, Ryan, but you never showed the dialog.  it should be:  </p>\n\n<pre><code>if (dlg.ShowDialog() == DialogResult.OK)\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/31031', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/177/']