4 Replies - 320 Views - Last Post: 24 January 2014 - 06:56 AM Rate Topic: -----

#1 JaKe_Talbot  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-January 14

how do you get an element by class name?

Posted 24 January 2014 - 05:50 AM

ok so im using vb 2012 and i have been looking how to get an element via a class name, would someone be able to give me some insight?
Is This A Good Question/Topic? 0
  • +

Replies To: how do you get an element by class name?

#2 ybadragon  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,118
  • Joined: 11-May 12

Re: how do you get an element by class name?

Posted 24 January 2014 - 06:42 AM

You can use the TypeOf operator so say you have an ArrayList of Objects and there are multiple types of objects in this list and you are looking for just the Integers you would do the following

Dim myList As New ArrayList
<insert code to populate arrayList>
For Each o As Object in myList
  If TypeOf o Is Integer Then
    <insert code to do stuff>
  End If
Next


Was This Post Helpful? 0
  • +
  • -

#3 DarenR  Icon User is online

  • D.I.C Lover

Reputation: 433
  • View blog
  • Posts: 3,006
  • Joined: 12-January 10

Re: how do you get an element by class name?

Posted 24 January 2014 - 06:54 AM

are you talking about

 Dim PageElement As HtmlElementCollection = WebBrowser1.document.GetElementsByTagName("input")
        For Each CurElement As HtmlElement In PageElement
            TextBox1.Text = TextBox1.Text + CurElement.GetAttribute("value") + Environment.NewLine
        Next



Was This Post Helpful? 0
  • +
  • -

#4 ybadragon  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,118
  • Joined: 11-May 12

Re: how do you get an element by class name?

Posted 24 January 2014 - 06:56 AM

It didn't even cross my mind that they were looking through html :P good catch :)
Was This Post Helpful? 0
  • +
  • -

#5 DarenR  Icon User is online

  • D.I.C Lover

Reputation: 433
  • View blog
  • Posts: 3,006
  • Joined: 12-January 10

Re: how do you get an element by class name?

Posted 24 January 2014 - 06:56 AM

View Postybadragon, on 24 January 2014 - 08:56 AM, said:

It didn't even cross my mind that they were looking through html :P/> good catch :)/>

well their question is vague at best
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1