Link to home
Start Free TrialLog in
Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America

asked on

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.
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Do you want to just add tags around the text?

I mean

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

???
Avatar of VBdotnet2005

ASKER

I want to convert an actual txt (the whole file) into HTML file.
ASKER CERTIFIED SOLUTION
Avatar of blandyuk
blandyuk
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i don't see  Server.HTMLEncode
Ah, you need to import the below and use HttpUtility.HtmlEncode:

Imports System.Web

html = HttpUtility.HtmlEncode(text)
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