9 Replies - 1200 Views - Last Post: 29 June 2012 - 09:06 AM Rate Topic: -----

#1 bigcake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 12

How to grab an element by it class, and saying if it contains a number

Posted 27 June 2012 - 11:58 AM

Hi Guys

I was just wondering if anybody can help me with a problem i have been having. Basically what i am trying to do is grab an element off a WebPage by it's class name and make Vb automatically look up to see if there is a number greater than with in the element. I have the html code below.

<div class="tix_limit_num">0</div>

Any suggestions here guys.

Thank You In Advance.

Is This A Good Question/Topic? 0
  • +

Replies To: How to grab an element by it class, and saying if it contains a number

#2 bigcake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 12

Re: How to grab an element by it class, and saying if it contains a number

Posted 27 June 2012 - 01:09 PM

any suggestions
Was This Post Helpful? 0
  • +
  • -

#3 bigcake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 12

Re: How to grab an element by it class, and saying if it contains a number

Posted 28 June 2012 - 06:41 AM

any ideas
Was This Post Helpful? 0
  • +
  • -

#4 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 209
  • View blog
  • Posts: 1,369
  • Joined: 16-March 11

Re: How to grab an element by it class, and saying if it contains a number

Posted 28 June 2012 - 08:53 AM

Yes. Grab the HtmlElements of your HTMLDocument, grab by tag name "div" and find the text you need.

        For Each y As HtmlElement In WebBrowser1.document.GetElementsByTagName("div")

            ListBox1.Items.Add(y.InnerText)
 
        Next



Something along the lines of this. I suggest exploring the html objects of the .net framework. MSDN is useful.
Was This Post Helpful? 0
  • +
  • -

#5 bigcake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 12

Re: How to grab an element by it class, and saying if it contains a number

Posted 28 June 2012 - 09:06 AM

may i ask why there is a listbox that is not what i am wanting to use. I am wanting to grab and element by it's class and say if it contains a number then do something

Picture below (what the html is)
Was This Post Helpful? 0
  • +
  • -

#6 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 209
  • View blog
  • Posts: 1,369
  • Joined: 16-March 11

Re: How to grab an element by it class, and saying if it contains a number

Posted 28 June 2012 - 09:45 AM

No you may not ask. I'm not doing your work for you. I gave you an example to start you off, if you want code hand outs go somewhere else. Looks to me like you've done zero work for yourself, I googled and found many articles in no time whatsoever and the pace at which you post on your own thread shows that you are just waiting for others to do your work.
Was This Post Helpful? 0
  • +
  • -

#7 bigcake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 12

Re: How to grab an element by it class, and saying if it contains a number

Posted 28 June 2012 - 10:25 AM

i thought, this is what forums was for, is to help people work out codes for things and learn. So can anybody help with this. I know how to get it by id, but i am wanting. the code to be similar to


if classname = "mam_limit_num") and contains an integer >0
then do something
Was This Post Helpful? 0
  • +
  • -

#8 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 209
  • View blog
  • Posts: 1,369
  • Joined: 16-March 11

Re: How to grab an element by it class, and saying if it contains a number

Posted 28 June 2012 - 10:27 AM

The forum is here to help people who have clearly done their own work, and need a helping hand on code they have worked on. You've no demonstrated any of that. You've just said "this Is what I want now give it to me".
Was This Post Helpful? 0
  • +
  • -

#9 bigcake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 12

Re: How to grab an element by it class, and saying if it contains a number

Posted 28 June 2012 - 10:30 AM

no, sorry, ok then i did do research. i found this a while ago but. i don't know how to modify this it to something i am trying to do.

Dim PageElement As HtmlElementCollection = Form2.WebBrowser1.document.GetElementsByTagName("div")
        For Each CurElement As HtmlElement In PageElement
           'ListBox1.Items.Add(CurElement.GetAttribute("className").ToString())
            If (CurElement.GetAttribute("className") = "playline") Then

                TextBox1.Text = CurElement.GetAttribute("id")
            End If


        Next


Any ideas, how to modify this. It will help a lot please.
Was This Post Helpful? 0
  • +
  • -

#10 bigcake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 24-June 12

Re: How to grab an element by it class, and saying if it contains a number

Posted 29 June 2012 - 09:06 AM

any suggestions
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1