我要读取的文件已经建好,可是用streamreader读取文件,路径也没有错,老抛出filenotfoundexception. 源代码如下:
  string path = textBox1.Text;
            try
            {
                StreamReader sr = new StreamReader(path);
                List<string> lines = new List<string>();
                string line = "";                while ((line = sr.ReadLine()) != null)
                {
                    lines.Add(line);
                }                TypeForm tf = new TypeForm(lines.ToArray());
                tf.Show();
                this.Hide();
                sr.Close();            }
            catch (ArgumentException ex)
            {
                MessageBox.Show("请输入文件名");
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show("请输入合法的文件名");
            }
        }
    }
}