Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Need help Getting some "Text" or Numbers from a Webpage - My Source Keeps Failing!!

$
0
0
Name:  jj6g.png
Views: 34
Size:  8.7 KB

Hi everyone..

I am trying to get the "Numbers" only showen in the Image Above, from a Webpage and into a Listbox. But I simply cant make it work. :confused: .I tried to use a Regex method, but since there are only one coma at the end of each Numbers, I ran out of ideas.

Hope I can get some help, about how to get the numbers directly into a Listbox?

My Regex Code:
Code:

    Public Function GetBetween(ByVal input As String, ByVal str1 As String, ByVal str2 As String, ByVal index As Integer) As String
        Dim temp As String = Regex.Split(input, str1)(index + 0)
        Return Regex.Split(temp, str2)(0)
    End Function


My Main code looks something like this Code below:

Code:

Private Function GetProc(ByVal Proc As String)
        Try
            Dim Webreq As HttpWebRequest = HttpWebRequest.Create("HERE GOES THE URL")
            Using Webres As HttpWebResponse = Webreq.GetResponse
                Using Reader As New StreamReader(Webres.GetResponseStream)
                    Using Rich As New RichTextBox With {.Text = Reader.ReadToEnd}
                        For i As Integer = 0 To Rich.Lines.Count - 1
                            Dim line As String = Rich.Lines(i)
                            If line.Contains(Chr(34) & "proc" & Chr(34)) Then
                                Dim Num As Integer = 3
                                Do Until Rich.Lines(i + Num).Contains("]")
                                    ListBox1.Items.Add(GetBetween(Rich.Lines(i + Num), "between1", "between2", 1))
                                    Num += 1
                                Loop
                                Exit Function
                            End If
                        Next
                    End Using
                End Using
            End Using
        Catch ex As Exception
            ListBox1.Items.Add("None!")
        End Try
    End Function


Thank you very much in advance!
Attached Images
 

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>