How to make the loop wait to load the webbrowser component before going to the next item?

Asked

Viewed 129 times

1

I am reading the contents of a textbox, and using a "loop for each" to pass the string in sequence to the url on localhost that contains php code:

$var = $_GET["nts"];
echo $var;

So far so good, the problem is that the loop does not wait for the full loading of the webbrowser document, so, for example, I cannot parse the html document of each string, the idea is to throw a string into the webbrowser and wait for the full loading of the webbrowser document, to launch the second string and so on.

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim tb As String = TextBox1.Text
    If String.IsNullOrEmpty(tb) Then
        MsgBox("Null")
    Else
        For Each t As String In tb
            If (String.IsNullOrWhiteSpace(t)) Then
            Else
                WebBrowser1.Navigate(String.Concat("http://localhost/a/as.php?nts=", t))
            End If
        Next
    End If
End Sub

Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

End Sub

1 answer

0

From what I understand the problem is in

Dim tb As String = TextBox1.Text

as this will only take a string q would be Textbox1.Text, and so only make a request with the full text of Textbox1, a simple method to solve this would be using

Dim tb As String() = Split(TextBox1.Text, " ")

So it would separate each word in the spaces and thus allow to send several requests with each word of the Textbox.

If the problem continues comment here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.