How to make the loop wait for loading the 'webbrowser' component before going to the next item?

1

I'm reading the contents of a textbox, and using a "for each loop" to pass the string in sequence to the url in localhost containing the php code:

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

So far so good, the problem is that the loop does not wait for the full load of the webbrowser document, so, for example, I can not parse the html document of each string, the idea is to throw a string in the webbrowser and wait for 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
    
asked by anonymous 20.09.2015 / 20:12

1 answer

0

From what I understood the problem is in

Dim tb As String = TextBox1.Text

As this will only take a string that would be the TextBox1.Text, and thus making it only send a request with the full text of TextBox1, a simple method to solve this would be using

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

This would separate each word in the spaces and thus allow multiple requests to be sent with each word in the TextBox.

If the problem continues, comment here.

    
27.09.2015 / 00:31