I got this error sometimes, thats weird...
Sometimes the software works and sometime it gives this error.
cmmBox.SelectedItem is a URL
HTMLSource is a function to grab the HTML page.
myPageNumber2 is a integer.
Here is the specific line and the whole code:

Specific Line:

sourcePage2.Text = HTMLSource(cmmBox.SelectedItem & "/members?p=" & myPageNumber2)

Whole Code:

Do While myPageNumber2 <= pagesToScan
            If allowScan = True Then
                sourcePage2.Text = HTMLSource(cmmBox.SelectedItem & "/members?p=" & myPageNumber2)

                For Each myLine2 As String In sourcePage.Lines
                    If myLine2.Contains("<p><a class=" & """" & "linkFriend_") Then
                        myLine2 = myLine2.Replace("<p><a class=" & """" & "linkFriend_", "")
                        If myLine2.Contains("/id/") Then
                            iStartIndex2 = myLine2.IndexOf("id/") + 3
                            iEndIndex2 = myLine2.IndexOf(">") - 1
                            userBox.Items.Add(myLine2.Substring(iStartIndex2, iEndIndex2 - iStartIndex2))
                        End If
                    End If
                Next
                myPageNumber1 = myPageNumber1 + 2
            End If
        Loop

Recommended Answers

All 4 Replies

Why are you reading into sourcepage2 and then handling lines from sourcepage?

Nice point i changed that but still the same error :(

Care to share code for HTMLSource? Are you using arrays in that function?

are you testing to see if an item has actually been selected by the user.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.