M
MaartyMan
Hi, I am new to C#. Maybe someone can help me with this: crawlBrowser is a
WebBrowser on my Form. When I use Document.Write below (commented out) the
code gets past the loop, so the page "loads". If I use Navigate, however,
crawlBrowser.IsReady stays in the "Loading" state forever, with
crawlBrowser.IsBusy false, and crawlBrowser.Url doesn't update, stays with
the initialized "about:blank" string. If I remove the loop, however, the page
loads eventually, but I would like to continue with code in this function.
Please help, I've tried everything I can think of and read all the posts I
could find?
//crawlBrowser.Document.Write("test123");
crawlBrowser.Navigate("www.google.com");
while (!IsWebBrowserCompleted())
{
Thread.Sleep(1000);
}
here is the code for method IsWebBrowserCompleted:
private bool IsWebBrowserCompleted()
{
bool ok = false;
switch (crawlBrowser.ReadyState)
{
case WebBrowserReadyState.Interactive:
case WebBrowserReadyState.Complete:
case WebBrowserReadyState.Loaded:
ok = true;
break;
case WebBrowserReadyState.Uninitialized:
case WebBrowserReadyState.Loading:
break;
}
return ok;
}
WebBrowser on my Form. When I use Document.Write below (commented out) the
code gets past the loop, so the page "loads". If I use Navigate, however,
crawlBrowser.IsReady stays in the "Loading" state forever, with
crawlBrowser.IsBusy false, and crawlBrowser.Url doesn't update, stays with
the initialized "about:blank" string. If I remove the loop, however, the page
loads eventually, but I would like to continue with code in this function.
Please help, I've tried everything I can think of and read all the posts I
could find?
//crawlBrowser.Document.Write("test123");
crawlBrowser.Navigate("www.google.com");
while (!IsWebBrowserCompleted())
{
Thread.Sleep(1000);
}
here is the code for method IsWebBrowserCompleted:
private bool IsWebBrowserCompleted()
{
bool ok = false;
switch (crawlBrowser.ReadyState)
{
case WebBrowserReadyState.Interactive:
case WebBrowserReadyState.Complete:
case WebBrowserReadyState.Loaded:
ok = true;
break;
case WebBrowserReadyState.Uninitialized:
case WebBrowserReadyState.Loading:
break;
}
return ok;
}