Valerie Meunier

Valerie Meunier

  • 963
  • 693
  • 72k

openFileDialog1.CheckFileExists = true;

Mar 23 2022 7:53 AM

Hi

when i use OpenFileDialog, i wonder what the use is of this line: openFileDialog1.CheckFileExists = true; because it makes no difference when i don't use it. When a file doesn'nt exist, i always get a message.

Thanks

V.

openFileDialog1.Filter = "Text files |*.txt";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                openFileDialog1.InitialDirectory = "C:\\Users\\myname\\Documents\\opendialog";
                //openFileDialog1.CheckFileExists = true;
                textBox1.Text = openFileDialog1.FileName;
                richTextBox1.Text = File.ReadAllText(openFileDialog1.FileName);
                len = richTextBox1.Text.Length;
            }


Answers (2)