I am having issues with illegal characters I am trying to import two documents as lists or arrays. a document is chosen from the file browser and the path is formatted ready to be read in.
I keep getting illegal character errors when it tries to step through the read all lines.
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = "C# Corner Open File Dialog";
fdlg.InitialDirectory = @"c:\";
fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
fdlg.FilterIndex = 2;
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
{
textBox2.Text = fdlg.FileName;
var gold1 = "@" + '"' + fdlg.FileName + '"';
textBox4.Text = gold1;
textBox5.Text = gold1;
string[] lines = System.IO.File.ReadAllLines(gold1);
//foreach (var line in lines)
{
// Console.WriteLine(line);
}
}
}