Reputation: 13
In the text file it prints on a new line but when it is displayed in the text box it is on the same line any ideas how to fix this?
{
string[] justJeansArray = new string[10];
protected void Page_Load(object sender, EventArgs e)
{
string filepath = Server.MapPath("~") + "//app_data\\justJeansBlog.txt";
StreamReader sr = new StreamReader(filepath);
string justJeansstring = sr.ReadToEnd();
string[] justJeansArray = justJeansstring.Split('\n');
for (int i = justJeansArray.Length - 1; i > justJeansArray.Length - 6; i--)
{
blogTB.Text += justJeansArray[i] + "\n\n";
}
sr.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
StreamWriter sw = new StreamWriter(Server.MapPath("~") + "//app_data\\justJeansBlog.txt", true);
sw.WriteLine(messageTB.Text);
sw.Close();
Response.Redirect("justJeans.aspx");
}
}
Upvotes: 0
Views: 51