By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,190 Members | 1,555 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,190 IT Pros & Developers. It's quick & easy.

save textbox value

P: 33
hi,
i wanna save the textbox values in notepad(.txt). can u plz guide me how to proceed
Nov 1 '09 #1
Share this Question
Share on Google+
3 Replies


P: 3
you mean you wanna save the text that is in the text-box into a (.txt) file that may be opened in notepad?
Nov 1 '09 #2

P: 33
yup exactly
there are 4 textboxes. and i want to save the values of all textbox in a single notepad.
Nov 1 '09 #3

P: 3
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
Nov 1 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.