Last post Sep 06, 2016 02:31 AM by Deepak Panchal
Sep 05, 2016 08:42 AM|Lexi85|LINK
I have a textbox, panel and save button...this is in relation to connecting a server
I need to do is...whenever user clicks save button....it has to store all info in a text file in below format
1.Code Sent : (text in textbox) time
Code Recieved: Text that comes in Panel and Time
2.Code Sent : (text in textbox) time
and so on....basically a logfile with all details in above format how do I do that?
Sep 05, 2016 11:54 PM|fazioliamboina|LINK
My.computer.filesystem.writealltext(server.mappath("~\App_Data\Logs\Logfile.txt"), environment.newline & "a line to log", true)
it is recommended to chunk logfiles to new files every hour.
Sep 06, 2016 02:31 AM|Deepak Panchal|LINK
you can try to use code below to write the data from textbox to text file.
protected void Button1_Click(object sender, EventArgs e)
string currtm = DateTime.Now.ToString();
string lines = "Code sent in Textbox: Time-" + currtm + Environment.NewLine + TextBox1.Text;
// Write the string to a file.
System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\v-padee\Desktop\demo.txt",true);
it will give you output like below.