I create the file like this System.IO.File.Create("pallingtest1.txt") but how do I tell it where to save the file?

can anyone help?

0
jolyon
1/22/2008 3:35:25 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

4 Replies
1263 Views

Similar Articles

[PageSpeed] 40
Get it on Google Play
Get it on Apple App Store

Why don't you specify the fully qualified path where you want to write the file rather than try and figure out where its going to write it? 


Jeev
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
0
Jeev
1/22/2008 3:43:08 PM

 From the MSDN docs:

 

<i>The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.</i>

http://msdn2.microsoft.com/en-us/library/d62kzs03.aspx 

0
cromar
1/22/2008 3:43:48 PM

thanks

0
jolyon
1/22/2008 3:50:28 PM

I now have the following code and it creates the file but does not write to it.....does anyone know why?

Dim FILE_NAME As String = "C:\colourhead\pallingtest" & newsId & ".txt"

 

If System.IO.File.Exists(FILE_NAME) = True Then

 

MsgBox(
"file already exists")

 

Else

 

System.IO.File.Create(
"C:\colourhead\pallingtest" & newsId & ".txt")

 

MsgBox(
"File Created")

 

Dim objWriter As New System.IO.StreamWriter(FILE_NAME)

 

objWriter.Write(
"come on sucker")

 

objWriter.Close()

 

MsgBox(
"Text written to file")

 

End If

0
jolyon
1/22/2008 3:57:47 PM
Reply:

Web resources about - I create the file like this System.IO.File.Create("pallingtest1.txt") but how do I tell it where to save the file? - asp.net.getting-started

Resources last updated: 12/15/2015 6:03:59 PM