how to do a document completed void to a web browser variable?

Yairk_kaufmann 6 Reputation points
2021-03-07T05:42:38.087+00:00

I want to do a function when the browser complete to load the document but it's in variable

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,289 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Timon Yang-MSFT 9,576 Reputation points
    2021-03-09T02:52:50.507+00:00

    I think you should need WebBrowser.DocumentCompleted Event.

            private void Form1_Load(object sender, EventArgs e)  
            {  
                WebBrowser WebBrowser = new WebBrowser();  
                WebBrowser.DocumentCompleted += WebBrowser_DocumentCompleted;  
            }  
      
            private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)  
            {  
               //do your function  
            }  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.