how to save textbox text into existing txt file using c#

how to save textbox text into existing txt file using c#

Page 1 of 1

3 Replies - 54702 Views - Last Post: 22 September 2008 - 11:54 AM Rate Topic: -----

#1 lakshman436  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-September 08

how to save textbox text into existing txt file using c#

Post icon  Posted 22 September 2008 - 03:55 AM

hi,

plz help me how to save textbox text into existing txt file using c#

This post has been edited by lakshman436: 22 September 2008 - 04:28 AM

Is This A Good Question/Topic? 0
  • +

Replies To: how to save textbox text into existing txt file using c#

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6052
  • View blog
  • Posts: 23,487
  • Joined: 23-August 08

Re: how to save textbox text into existing txt file using c#

Posted 22 September 2008 - 04:17 AM

Open existing file for appending.
Write contents of TextBox control's Text property to file.
Close file.
Was This Post Helpful? 0
  • +
  • -

#3 gbertoli3  Icon User is offline

  • DIC at Heart + Code
  • member icon

Reputation: 40
  • View blog
  • Posts: 1,162
  • Joined: 23-June 08

Re: how to save textbox text into existing txt file using c#

Posted 22 September 2008 - 06:55 AM

That's about as close as you will get without showing your code.
Was This Post Helpful? 0
  • +
  • -

#28 debjit625  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 51
  • View blog
  • Posts: 446
  • Joined: 06-September 08

Re: how to save textbox text into existing txt file using c#

Posted 22 September 2008 - 11:54 AM

View Postlakshman436, on 22 Sep, 2008 - 03:55 AM, said:

hi,

plz help me how to save textbox text into existing txt file using c#



		  //Use StreamWriter class.
			StreamWriter sw = new StreamWriter("E:\\test.txt");

			//Use writeline methode to write the text and 
			//in para.. put your text, i have used  textBox1's text  
			sw.WriteLine(textBox1.Text);

			//always close your stream
			sw.Close();



Enjoy Debjit
Was This Post Helpful? 1

Page 1 of 1