The problem is you want an instance of a class, rather than using the class directly. However, FileDialog
is an abstract class which means you cannot instantiate it directly, but there are a couple of implementations that you can use...
Assuming you want to select (open) a file, then you can use OpenFileDialog
class:
OpenFileDialog dialog = new OpenFileDialog();
if(dialog.ShowDialog() != DialogResult.Cancel)
{
txtLocation.Text = dialog.FileName;
cmdWatch.Enabled = true;
}
Alternatively, if you want to choose a file location for saving then use SaveFileDialog