txt to HTML

Is there a way to convert txt file to HTML in VB.net? Please provide links or code if have it. Thank you very much.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do you want to just add tags around the text?

I mean

My Sample String -> <html><body>My Sample String</body></html>

VBdotnet2005Author Commented:
I want to convert an actual txt (the whole file) into HTML file.
If you simply want to have it formatted like the test, by in HTML, simple replace all vbCrLf with <br /> and Server.HTMLEncode the text, then write simple HTML tags and output to new file:

Imports System.IO

Dim text As String = File.ReadAllText(textFile)
Dim html As String

html = Server.HTMLEncode(text)
html = html.Replace(vbCrLf, "<br />" + vbCrLf)
html = "<html><body><p>" + html + "</p></body></html>"

File.WriteAllText("htmlFile", html)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

VBdotnet2005Author Commented:
i don't see  Server.HTMLEncode
Ah, you need to import the below and use HttpUtility.HtmlEncode:

Imports System.Web

html = HttpUtility.HtmlEncode(text)
VBdotnet2005Author Commented:
I did import, but I don't see HttpUtility.HtmlEncode

This is what I have. I am using VS 2008 pro
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports System.Data.OleDb
Imports Microsoft.Office.Interop
Imports System.Web
Imports System.Data.DataSet
Imports System.Data.DataTable
Imports System.Net.Mail
Imports System.Linq
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.Xml
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.