Vb.net 等待页面加载完成-Windows窗体应用程序

Vb.net 等待页面加载完成-Windows窗体应用程序,vb.net,winforms,Vb.net,Winforms,我在应用程序中使用 Private Sub wb_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wb.DocumentCompleted 但我需要在登录网站后导航到另一个页面 如何等待第一页完全加载,然后导航到另一页?使用webbrowser document completed事件: 是链接使用web

我在应用程序中使用

Private Sub wb_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wb.DocumentCompleted
但我需要在登录网站后导航到另一个页面


如何等待第一页完全加载,然后导航到另一页?

使用webbrowser document completed事件:


是链接

使用webbrowser文档完成事件:


是一个链接

嗨,这段代码对我很有帮助

     private void waitTillLoad()
           {
               WebBrowserReadyState loadStatus;
               //wait till beginning of loading next page 
               int waittime = 100000;
               int counter = 0;
               while (true)
               {
                   loadStatus = webBrowser1.ReadyState;
                   Application.DoEvents();

                   if ((counter > waittime) || (loadStatus == WebBrowserReadyState.Uninitialized) || (loadStatus == WebBrowserReadyState.Loading) || (loadStatus == WebBrowserReadyState.Interactive))
                   {
                       break;
                   }
                   counter++;
               }

               //wait till the page get loaded.
               counter = 0;
               while (true)
               {
                   loadStatus = webBrowser1.ReadyState;
                   Application.DoEvents();

                   if (loadStatus == WebBrowserReadyState.Complete)
                   {
                       break;
                   }
                   counter++;

               }
}

嗨,这个代码和平会像对我一样有帮助

     private void waitTillLoad()
           {
               WebBrowserReadyState loadStatus;
               //wait till beginning of loading next page 
               int waittime = 100000;
               int counter = 0;
               while (true)
               {
                   loadStatus = webBrowser1.ReadyState;
                   Application.DoEvents();

                   if ((counter > waittime) || (loadStatus == WebBrowserReadyState.Uninitialized) || (loadStatus == WebBrowserReadyState.Loading) || (loadStatus == WebBrowserReadyState.Interactive))
                   {
                       break;
                   }
                   counter++;
               }

               //wait till the page get loaded.
               counter = 0;
               while (true)
               {
                   loadStatus = webBrowser1.ReadyState;
                   Application.DoEvents();

                   if (loadStatus == WebBrowserReadyState.Complete)
                   {
                       break;
                   }
                   counter++;

               }
}