开发者

How to wait until webBrowser1 completey loads after webBrowser1 click or submit event fired

开发者 https://www.devze.com 2023-01-23 07:33 出处:网络
there are countless of examples开发者_JS百科 how to wait until page fully loads after navigate event

there are countless of examples开发者_JS百科 how to wait until page fully loads after navigate event

but there are not even a single example how to wait until submit of click event fired next page fully loads

how can i achive this

what i want is after webBrowser1 click or submit (form) event fired how to wait next page (after click or submit event it goes another page) fully loads

thank you


Would the DocumentCompleted event be what you are looking for?

Here's the example given on the documentation page. It prints the page as soon as the document has been fully loaded. You can modify it for your needs.

private void PrintHelpPage()
{
    // Create a WebBrowser instance. 
    WebBrowser webBrowserForPrinting = new WebBrowser();

    // Add an event handler that prints the document after it loads.
    webBrowserForPrinting.DocumentCompleted +=
        new WebBrowserDocumentCompletedEventHandler(PrintDocument);

    // Set the Url property to load the document.
    webBrowserForPrinting.Url = new Uri(@"\\myshare\help.html");
}

private void PrintDocument(object sender,
    WebBrowserDocumentCompletedEventArgs e)
{
    // Print the document now that it is fully loaded.
    ((WebBrowser)sender).Print();

    // Dispose the WebBrowser now that the task is complete. 
    ((WebBrowser)sender).Dispose();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消