Creating a new file

gomindi

Active member
Joined
Aug 28, 2002
Messages
25
Location
UT
I am trying to create a new file that will temporarily store information from my text boxes.

Does somebody know the syntax to create a new file?

Thank you! Mindi Wright
 
Code:
Create a file and write to it
        Dim f As IO.StreamWriter
        f = IO.File.CreateText(IO.Directory.GetParent( _
            Application.ExecutablePath).ToString & "\Temp.txt")

        f.Write("blah")
        f.Close()
 
Do you know how I can change the directory?

This worked, it created it in my visual studio projects/test/bin folder. But do you know how I can change this? I tried to add a different path before the \temp.txt, but that didnt work for me.

I really appreciate your help!
 
Change the Application.ExecutablePath).ToString & "\Temp.txt") bit
to something else, like C:\stuff\Temp.txt. You can give it a relative
path like I did, or an absolute path.
 
Cool

Thank you!

Hey where did you get the posted code? Or any other "beginner" tutorials out there to help me with Files?

thanks! Mindi
 
I read the MSDN :) It should have been installed with .NET if you
chose to install it.
 
Back
Top