Hello,
Right, basically I'm trying to write some HTML to a file, now the problem is that I do not want to write the whole of the HTML in the C# program, incase I ever need to change the HTML file. All I want to do is change a few variables.
Now, I have this function:
public static void WebPage(int gradeA, int gradeB, int gradeC, int gradeD, int gradeE, int gradeF)
{
// read the HTML file
TextReader webpage = new StreamReader ("/Users//Desktop/Assignment/webpage.html");
string LookUp;
string str = "";
while ((LookUp = webpage.ReadLine()) != null)
{
string replace = "var grade1 = \"\"";
string replaceWITH = "var grade1 = \"" + gradeA + "\"";
str = LookUp.Replace (replace, replaceWITH);
}
}
Now, if I add this line:
Console.Write (str);
It will replace it on console, however, if I try to write to the HTML file, it will completely remove EVERYTHING in that file and give me nothing.
Please can you help me?