OpenFileDialog: filer, initial directory : OpenFileDialog « GUI Windows Forms « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Windows.Forms;

static class MainClass
{
    [STAThread]
    static void Main()
    {
        OpenFileDialog dlg = new OpenFileDialog();
        dlg.Filter = "Rich Text Files (*.rtf)|*.RTF|" +
          "All files (*.*)|*.*";
        dlg.CheckFileExists = true;
        dlg.InitialDirectory = Application.StartupPath;
  
        if (dlg.ShowDialog() == DialogResult.OK)
        {
            Console.WriteLine(dlg.FileName);
            
        }
    }
}








23.45.OpenFileDialog
23.45.1.Simple Open file dialogSimple Open file dialog
23.45.2.OpenFileDialog Event: FileOkOpenFileDialog Event: FileOk
23.45.3.OpenFileDialog: browsing for a fileOpenFileDialog: browsing for a file
23.45.4.OpenFileDialog: browsing for a set of filesOpenFileDialog: browsing for a set of files
23.45.5.OpenFileDialog: filer, initial directory