Hi all,
I just gone through one requirement.
I want to take the value from the user.
I have one txt file in the same project where i take value from the user.
The value should save into the last line of the txt file.
How to do it?
Thanks
Darma
Loading

VulpesRank #55 · 29.2K reputationPosted Oct 24, 2012, 3:15 AM EDT
If, say, the user is entering the new line in a textbox and then pressing a button to append it to a file on the server, then the code would be similar to this:
VulpesRank #55 · 29.2K reputationPosted Oct 24, 2012, 2:32 AM EDT
using System;
using System.IO;
class Test
{
static void Main()
{
StreamWriter sw = new StreamWriter("darma.txt", true); // 'true' appends to file
Console.Write("Enter line to append : ");
string line = Console.ReadLine();
sw.Write("\r\n" + line);
sw.Close();
}
}
darma tejaRank #3,199 · 449 reputationPosted Oct 24, 2012, 2:48 AM EDT
Thanks for reply.
I want to do it in webform not on console.
I want to add a new value in new line into the text file.
Darma