Hello! I saw your post on how to save the content of a textbox to a .txt file. Maybe you can help me. I have a textbox, textBox1, and a button, Save. When you push Save it should save the content of textBox1 to a .txt file. I copied the code, but I received some errors:
<<'System.IO.Fi leMode' does not contain a definition for 'OpenORCreate'> >
and
<<'System.IO.St reamWriter' does not contain a definition for...
User Profile
Collapse
-
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("myT extFile.txt", FileMode.OpenOR Create);
StreamWriter sw = new StreamWriter(aF ile);
sw.WriteLine(th eData);
sw.close();
i'm assuming that the text box is called t... -
you mean you wanna save the text that is in the text-box into a (.txt) file that may be opened in notepad?Leave a comment:
-
How do i do two consecutive WebRequest.GetResponse ?
i'm new to c#
the following is my code:
*************** *************** ************
HttpWebRequest myRequest = (HttpWebRequest )WebRequest.Cre ate("http://www.google.com" );
HttpWebResponse myResponse = (HttpWebRespons e)myRequest.Get Response();
myResponse.Clos e();
myRequest = (HttpWebRequest )WebRequest.Cre ate("http://www.mns.com");
myResponse = (HttpWebRespons e)myRequest.Get Response();...
No activity results to display
Show More
Leave a comment: