private void button1_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { string fileName = ofd.FileName; textBox1.Text = String.Empty; Result_box.Text = String.Empty; try { { textBox1.Text = File.ReadAllText(fileName); DP.Process(fileName); } } catch { MessageBox.Show("The file could not be read"); } } }