Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 27,122 times

Related Categories

Save the contents of a textbox to a file

Here's another small bit of code that shows you how to save the contents of TextBox1 to test.txt

' Get a free file number
FileNum = FreeFile

' Create Test.txt
Open App.Path & "Test.txt" For Output As FileNum

' Write the contents of TextBox1 to Test.txt
Print #FileNum, TextBox1.Text

' Close the file
Close FileNum

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments

  • Posted by Codecode on 08 Feb 2004

    If you are using VB4 there is a file in samples folder called Fileio and in the code of that you can see how to save the file, add records to that file, create another file add records to that as well...

  • The Outputed File

    Posted by treverrow on 21 Jan 2004

    Is there a way to specify where the file goes when it is outputed?

    and is it possible to add to that file instead of just overwriting them content?