I'm working on extracting information from the html through vb. The html file looks like:
<div class='titlebar'><h1>Event Log started at 02/06/2015 13:07:30</h1></div>
<div class='Information'><h1>02/06/2015 13:09:30 | Log has opened</h1></div>
<div class='Interest'><h1>02/06/2015 13:13:03 | finished!</h1></div>
<div class='Interest'><h1>02/06/2015 13:17:12 | finished!</h1></div>
<div class='Interest'><h1>02/06/2015 13:21:35 | finished!</h1></div>
<div class='Interest'><h1>02/06/2015 13:24:58 | finished!</h1></div>
<div class='Warning'><h1>02/06/2015 17:04:33 | Failed to stop, retrying...</h1></div>
<div class='Warning'><h1>02/06/2015 17:04:56 | Error during mix
From this, I need to be able to extract information into different listbox's for class =interest, class=warning and class=information. So through my research I obtained the below code:
Private Function getHtml(ByVal Adress As String) As String
Dim rt As String = ""
Dim wRequest As WebRequest
Dim wResponse As WebResponse
Dim SR As StreamReader
wRequest = WebRequest.Create(Adress)
wResponse = wRequest.GetResponse
SR = New StreamReader(wResponse.GetResponseStream)
rt = SR.ReadToEnd
SR.Close()
Return rt
End Function
Private Sub btn_lookup_Click(sender As Object, e As EventArgs) Handles btn_lookup.Click
TextBox2.Text = getHtml(TextBox1.Text)
End Sub
The above code will copy the whole source information into the textbox. Is it possible only copy the specific information. So for
<div class='Interest'><h1>02/06/2015 13:24:58 | finished!</h1></div>
I need to copy 02/06/2015 13:24:58 | finished!
Is this possible?
Thank You