Author Options:

VB help, (text files)?

Hi, so basically i need to create a .txt file when i press a button but it has to be named as what i entered into textbox1.text ANY HELP GUYSSS!!!!!!!!!

3 Replies

Clarusglassboards (author)2010-09-13

http://msdn.microsoft.com/en-us/library/5t9b5c0c%28VS.85%29.aspx should provide you with the help you need. The MSDN is very helpful with these kinds of questions. :) Good luck.

note: recommend switching from VB to C++

PREDATOR_UK (author)2010-09-30

Oh and i wouldnt switch to c++ unless you want to do proper hard coding and windows programming.

PREDATOR_UK (author)2010-09-30

To easily create a text file we create something called a file stream. The filestream will then be assigned the of creating your file. We do this by using this code:

Dim fs as system.io.filestream ' Open the filestream
fs = system.io.fie.create("C:\Users\...") ' Or whatever path you want
fs.close ' Remember this because otherwise it can cause problems

Copy the above code straight in.