How to Use Open File Dialog in C# Windows Application?

Posted in  windows | 2022-04-06

How do I Use Open FileDialog in Windows Form?

The following example uses the Windows Forms Button controls Click event handler to open the OpenFileDialog with the ShowDialog method. After the user chooses a file and selects OK, an instance of the StreamReader class reads the file and displays its contents in the forms text box.

How Browse File in Windows Form C#?

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 ;
iffdlg.ShowDialog == DialogResult.OK
{

How to Use OpenFileDialog Control in Windows Form C#