I am trying to read entire block from notepad on C# code. How do I make this work?
private void pictureBox4_Click(object sender, EventArgs e)
{
string[] lines = File.ReadAllLines(@"C:\Users\AA\Downloads\test2.txt");
foreach (string line in lines)
{
Console.WriteLine(line);
}
}
content in text2.txt file is something like
panel1.Visible = false;
panel2.Visible = true;
panel3.Visible = false;
panel4.Visible = false;
panel5.Visible = false;
webBrowser1.Navigate("www.youtube.com");
If I make code like below and content in text.txt is just www.youtube.com, it read the line and execute but if I read entire block from notepad, it won't work. How do I make this work?
private void pictureBox4_Click(object sender, EventArgs e)
{
panel1.Visible = false;
panel2.Visible = true;
panel3.Visible = false;
panel4.Visible = false;
panel5.Visible = false;
string readText = System.IO.File.ReadAllText(@"C:\Users\AA\Downloads\test.txt");
webBrowser1.Navigate(readText);
}
Thank you in advance. :(