WebBrowser Control Delay ?

eawedat

Member
Joined
Nov 20, 2011
Messages
8
Programming Experience
1-3
hey all,

I have this code in VB.NET :

Having:
1 TextBox
1 Button

with this code:

VB.NET:
Public Class Form1
    Dim m As String()
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        m = TextBox1.Text.Split(Environment.NewLine)
        For Each k As String In m
            'MessageBox.Show(k)
            WebBrowser1.Navigate(k)
        Next

    End Sub


VB.NET:
input
www.a.com
www.b.com
www.c.com
www.google.com

it navigates only to the last website (Google)
i think that's because the for loop is faster that navigation process

is there any suggestion ?

maybe using threads or sleep helps! but i need someone to help me combining all together.


thanks a lot.
 
You start navigating and before that page has had a chance to load you immediately start navigating to the next. That's like clicking one link on a web page and then clicking another before anything happens. You need to just call Navigate once. That page will then load and the WebBrowser will raise its DocumentCompleted event, at which point you can navigate to the next.
 
Back
Top