Connecting Tech Pros Worldwide Help | Site Map

save textbox value

Newbie
 
Join Date: Oct 2009
Posts: 22
#1: 3 Weeks Ago
hi,
i wanna save the textbox values in notepad(.txt). can u plz guide me how to proceed
Newbie
 
Join Date: Nov 2009
Posts: 3
#2: 3 Weeks Ago

re: save textbox value


you mean you wanna save the text that is in the text-box into a (.txt) file that may be opened in notepad?
Newbie
 
Join Date: Oct 2009
Posts: 22
#3: 3 Weeks Ago

re: save textbox value


yup exactly
there are 4 textboxes. and i want to save the values of all textbox in a single notepad.
Newbie
 
Join Date: Nov 2009
Posts: 3
#4: 3 Weeks Ago

re: save textbox value


ok

1. make sure you add the using System.IO in the directives at the top. you need that to do reading/writing to files on the systm

String theData = textbox1.Text;

FileStream aFile = new FileStream("myTextFile.txt", FileMode.OpenORCreate);
StreamWriter sw = new StreamWriter(aFile);
sw.WriteLine(theData);
sw.close();


i'm assuming that the text box is called textbox1
Reply