l33t

I need to open an HTML file as plain text, and store its contents in a string.

I wrote some code to make minor changes to the string

Then I need to save the string into a NEW html file.

How would I go about doing this



Re: Visual Basic Language Storing HTML source in string then saving

Spidermans_DarkSide

 

Hi,

 I would look into using StreamReader and StreamWriter mainly and maybe the String.Split method.

See the url links in my post in this thread.>>

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1135010&SiteID=1

 

The MSDN library is a great resource for help on commands etcetera.>> http://msdn.microsoft.com/library/

 

Regards,

S_DS

 






Re: Visual Basic Language Storing HTML source in string then saving

l33t

perfect, now one more thing, how do i move to a new line (with a stringbuilder that is, see my code below)

Try

' Create an instance of StreamReader to read from a file.

Using sr As StreamReader = New StreamReader(tmpfile)

Dim line As String

Dim html As String

' Read and display the lines from the file until the end

' of the file is reached.

Do

line = sr.ReadLine()

Dim htmlsb As New Text.StringBuilder

htmlsb.Append(line)

'new line - htmlsb.Append()

html = htmlsb.ToString

Loop Until line Is Nothing

sr.Close()

End Using

Catch ex As Exception

' Let the user know what went wrong.

MsgBox("An error has occured:" + ex.Message, MsgBoxStyle.Critical, "ERROR")

End Try





Re: Visual Basic Language Storing HTML source in string then saving

Bruno Yu - MSFT

l33t,

What is the meaning of move to a new line with StringBuilder Do you mean you need to create a new instance of StreamBuilder and copy it in a new instance of StringBuilder Could you specify your problem Thank you for your question and waiting for your reply :-)