I believe it is created in the current directory. However, it is bad
programming practice to give just a filename. Try something like the
following:
Private Sub btnCreateText_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnCreateText.Click
'CreateText either creates or overwrites
Dim texttestwriter As StreamWriter =
File.CreateText(Server.MapPath("TextTest.txt"))
Dim writetime As Date = Date.Now
texttestwriter.WriteLine("This line was written at {0} {1}",
writetime.ToShortDateString(), writetime.ToLongTimeString())
texttestwriter.Close()
End Sub
Private Sub btnAppendText_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnAppendText.Click
'AppendText either creates or appends
Dim texttestwriter As StreamWriter =
File.AppendText(Server.MapPath("TextTest.txt"))
Dim writetime As Date = Date.Now
texttestwriter.WriteLine("This line was written at {0} {1}",
writetime.ToShortDateString(), writetime.ToLongTimeString())
texttestwriter.Close()
End Sub
Notice that when declaring and creating my StreamWriters I do not use the
StreamWriter constructor and I also use the Server.MapPath(filename)
function. If you have any more questions, feel free to ask. Good Luck!
--
Nathan Sokalski
http://www.nathansokalski.com/
"Mr. X." <no_spam_please@nospam_please.com> wrote in message
news:...
> Helo,
>
> For the code (The code is the code-behind an aspx page) :
> '************************************************* *
>
> Dim fileName As String
>
> Dim st As System.IO.StreamWriter
>
> filename = "a.txt"
>
> st = New System.IO.StreamWriter(fileName)
>
> st.Write("this is a text")
>
> st.Close()
>
> st = Nothing
>
> '**************************************
>
> The above code runs, there is not any file created.
>
> How can I save (and load) a file, and just putting simple text on it ?
>
> Thanks 
>