Support Forums
How do I add Textbox1.Text to a textfile? - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: How do I add Textbox1.Text to a textfile? (/showthread.php?tid=2838)



How do I add Textbox1.Text to a textfile? - nevets04 - 11-12-2009

How do I add Textbox1.Text to a textfile?


RE: How do I add Textbox1.Text to a textfile? - Nonmod - 11-12-2009

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();



RE: How do I add Textbox1.Text to a textfile? - Yoshi - 11-12-2009

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/programming/how-to-readwrite-file-in-vb6/7105.html
Sorry if that doesnt help.


RE: How do I add Textbox1.Text to a textfile? - nevets04 - 11-12-2009

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



RE: How do I add Textbox1.Text to a textfile? - Cyberknife - 11-17-2009

write this code in button click event

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