Read HTML file in VB

 Protected Sub LoadStatement()

            'Open a file for reading
            Dim FILENAME As String = Server.MapPath("agreement.htm")

            'Get a StreamReader class that can be used to read the file
            Dim objStreamReader As StreamReader
            objStreamReader = File.OpenText(FILENAME)

            'Now, read the entire file into a string
            Dim contents As String = objStreamReader.ReadToEnd()
            contents = contents.Replace("<br /><br />", vbCrLf)
            contents = contents.Replace("<br />", vbCrLf)
            contents = RemoveHTML(contents)
            Dim strAgreement As String
            strAgreement = "Independent Contractor Agreement" & vbCrLf & vbCrLf & contents

            txtAgreement.Text = strAgreement
        Catch ex As Exception

        End Try

Click here to see code in C#

Related Alrticles

Add Your Business in Free Listing

FREE!!! Registration