What is the best way to allow a user to view a file in C #?
using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Title = "Select a file"; if (dlg.ShowDialog()== DialogResult.OK) { //do something with dlg.FileName } }
I would say using the standard OpenFileDialog dialog box, this makes it less intimidating for new users and helps with a consistent interface.
Close, Ryan, but you never showed a dialogue. it should be:
if (dlg.ShowDialog() == DialogResult.OK)