Support Forums

Full Version: How do I add Textbox1.Text to a textfile?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I add Textbox1.Text to a textfile?
I suppose you want to write text to file.
For VB check this link.
http://www.freevbcode.com/ShowCode.Asp?ID=4492

If you code in C# :
Code:
System.IO.StreamWriter streamWrite = new System.IO.StreamWriter("C:\\output.txt");
streamWrite.Write("lalala");
streamWrite.Close();
Hey mate, I cant really explain it but read this tutorial and it should help.
Heres How you do it for VB.Net
http://www.vbtutor.net/vb2008/vb2008_lesson21.html
And for VB6
http://www.computing.net/answers/program.../7105.html
Sorry if that doesnt help.
Solved:
Code:
Using sw As New System.IO.StreamWriter("C:\Sample.txt")    'Opens/creates file & StreamWriter object
    sw.WriteLine(TextBox1.Text)    'Outputs textbox value
End Using    'Closes & disposes StreamWriter object
write this code in button click event

My.Computer.FileSystem.WriteAllText("Urfilepathname", TextBox1.Text, True)