Create an HTML file

  • Thread starter Thread starter Guest
  • Start date Start date
What do you mean. An HTML file is simply a text files with elements, so you
should be able generate the necessary string and write it out using the
FileStream. I assume this is not what you are looking for so can you
clarify your question.
 
Yes, I guess I am looking for an example of the FileStream method that would
take a string and write it out as a *.htm file
 
JackO said:
Yes, I guess I am looking for an example of the FileStream method that
would
take a string and write it out as a *.htm file

....and the string we're talking about already contains all HTML-tags?

Steven

- - -
 
You just create a text file with a .htm extension, and write the text to it,
just like you would write to any text file.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.
 
Does anyone have an example in VB.NET on how to create an HTML file.

This is in C#, but it should be reasonably similar to VB:

StreamWriter writer = new
StreamWriter(@"C:\myDirectory\myHTMLFile.htm", false);

writer.WriteLine("<html>");
writer.WriteLine("<head>");
writer.WriteLine(" <title>My HTML Page</title>");
writer.WriteLine("</head>");
writer.WriteLine("<body>");
writer.WriteLine(" <h1>Hello World!</h1>");
writer.WriteLine("</body>");
writer.WriteLine("</html>");

writer.Close();

HTH

rossum
 
Back
Top