vb.netvb.net-2010

Showing data from website in label vb.net


Basically, I am trying to get the the "Idle" text shown in picture below to appear in a label/textbox.

Website code

The text itself will change from 'Idle' to 'Active'. I was on adding the code to the Web Browser Navigated event.

so far I have tried:

Try
    Dim statusText As String
    statusText = Contact.WebBrowser1.Document.GetElementById("line1Button").GetAttribute("Value")
     statusLbl.Text = statusText
Catch ex As Exception
End Try

I have also change the 'GetAttribute' to 'Text' rather than value.

Any help would be appreciated. Thanks in advance.


Solution

  • Dim statusText As String
    statusText = Contact.WebBrowser1.Document.GetElementById("line1Button").InnerText
    statusLbl.Text = statusText
    

    Return clean text between <div> ... </div>. No html tags.