Jack
Jack

Reputation: 45

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.

Upvotes: 1

Views: 249

Answers (1)

c4pricorn
c4pricorn

Reputation: 3481

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

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

Upvotes: 2

Related Questions