How to disable OpenFileDialog opening files automatically?
<p>I am using following code to select a file to import in a Windows Forms project.</p>

<pre><code>OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "C# Corner Open File Dialog";
fdlg.InitialDirectory = @"c:\";
fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
fdlg.FilterIndex = 2;
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
{
    txtpath.Text = fdlg.FileName;
}
</code></pre>

<p>The problem is that the selected file is opened in the background which I don't want. What can I do to just get the path of selected file without opening it?</p>
