i have create a file :
Imports
System.io.....
System.IO.File.Create(
"C:\filename.html")now i want to edit it :
<html> bla </html>
i know that i can use Streamwriter
but
Dim
StreamW As StreamWriterstreamw.write("<html>bla</html>")
doesnt work what shold i do to wirte into html / txt files with stream writer

html editing problams
elgor
Oops, I forgot to mention that with the change I suggested you can lose the original:
System.IO.File.Create("C:\filename.html")
This is important to do because in the code you pasted above you are actually opening the file twice, something that doesn't generally work well. By removing the first one we only open the file where we need it and capture File.Open()'s return value of a FileStream to create your StreamWriter.
xRuntime
well i got the problam i just forgot to close the streamW tnx for you help .
then i can use streamwriter as file maker
FaheemKhan
A FileStream can be used to make files... and in the case of using File.Open(), a FileStream instance is returned. The FileStream class extends the Stream class which is one of the possible items you can pass into the creation of a StreamWriter.
A more direct way to have a FileStream instance create the file is to use one of its other constructors that takes a filename as an argument, the same goes for using a StreamWriter as well. Both can take in the base stream you want to work with or a path to the file that you want to access.
To really answer your question about what a FileStream is... we need to consider what a Stream is... in .NET a Stream is just a abstract idea about a data source... it could be a file, a memory location, network connection, just about anything.
The FileStream class inherits from the Stream class and extends it with methods and attributes that are more suited to dealing with files sitting on your harddrive while say the NetworkStream class does the same thing but for network connections.
Does this clear things up a bit better
whatupboo
o
so FileStream make files
and i changed the post right after you post yours i guess ...
and i dont really understand you can you explain about filestream
juergen.b
You will have to be more specific with regards to what is happening wrong
At first glance though... your StreamWriter reference by the name of StreamW... does it reference a new instance
Try changing:
Dim StreamW As StreamWriter
to:
Dim StreamW As New StreamWriter(System.IO.File.Create("C:\filename.html"))
to make it point to a new StreamWriter instance that references the file in question.
Does this work for you