OpenFileDialog.CheckFileExists : OpenFileDialog « System.Windows.Forms « C# / C Sharp by API






OpenFileDialog.CheckFileExists

 

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);
            
        }
    }
}

   
  








Related examples in the same category

1.new OpenFileDialog()
2.OpenFileDialog.FileOk
3.OpenFileDialog.Filter
4.OpenFileDialog.FilterIndex
5.OpenFileDialog.InitialDirectory
6.OpenFileDialog.Multiselect
7.OpenFileDialog.RestoreDirectory
8.OpenFileDialog.ShowDialog()
9.OpenFileDialog.ShowReadOnly
10.OpenFileDialog.Title