Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Websource sorting issue

Hey guys, I've started a new project. I've completed the Probux Ad Viewer and I need some help with this. Basicly for each class called "lolz" I need to check if it has a picture url that contains "money". The first code you see below is how I've sort of got it to the point where I need to get the url of a picture.
The last code is from the site. I'd really appreciate some help and thank you for your time!
Code
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim theElementCollection As HtmlElementCollection = Nothing
        theElementCollection = WebBrowser1.Document.GetElementsByTagName("div")
        For Each curElement As HtmlElement In theElementCollection
            If InStr(curElement.GetAttribute("classname").ToString, "lolz") Then



            End If
        Next
    End Sub
Code
<div class="lolz" style="float: right; background: url('hidden')"><img src="money.png" style="position: relative; left: -40px; top: -12px;"></div>
Do you mean something like this? 🙂
Code
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      For Each curElement As HtmlElement In WebBrowser1.Document.GetElementsByTagName("div")
      If curElement.GetAttribute("classname").Contains("lolz") Then
            Dim curElementImg As HtmlElementCollection = curElement.GetElementsByTagName("img")
            If curElementImg.Count = 1 Then : If curElementImg.Item(0).GetAttribute("src").Contains("money") Then
            'some code
            End If : End If
      End If
      Next
End Sub
(Aug 29, 2014 11:07 AM)Haru9 Wrote:  Do you mean something like this? 🙂
Code
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      For Each curElement As HtmlElement In WebBrowser1.Document.GetElementsByTagName("div")
      If curElement.GetAttribute("classname").Contains("lolz") Then
      Dim curElementImg As HtmlElementCollection = curElement.GetElementsByTagName("img")
      If curElementImg.Count = 1 Then : If curElementImg.Item(0).GetAttribute("src").Contains("money") Then
      'some code
      End If : End If
      End If
      Next
End Sub
I tried and didn't get any results changing lines here and there, but I've changed method and now I need to search for a word in a richtextbox then retrieve the the entire line.
I thumbled and stopped when I got this:
Quote: For Each Line As String In RichTextBox2.Lines
If (Line.ToString = "Lolz") Then
ListBox1.Items.Add(Line)
End If
Next

Code
For Each Line As String In RichTextBox2.Lines
      If (Line.ToLower.Contains("Lolz".ToLower)) Then
      ListBox1.Items.Add(Line)
      End If
Next
or
Code
Dim line_number As Integer = RichTextBox2.GetLineFromCharIndex(RichTextBox2.Find("Lolz"))
Dim line As String = RichTextBox2.Lines(line_number)
ListBox1.Items.Add(line)


Possibly Related Threads...
Thread / Author Replies Views Last Post
by lucienhfMar 22, 2024 03:06 AM 4 241 Mar 22, 2024 03:06 AM
Last Post: lucienhf
[Python] by ThisBearScatJan 27, 2020 06:27 PM 16 333 Jan 27, 2020 06:27 PM
Last Post: Lindros
[.NET] by JavaJaneMay 29, 2019 08:26 AM 1 184 May 29, 2019 08:26 AM
Last Post: tweety