This course - Tips on how to use the web browser control

v1.0 - last updated: 08/07/2006   

 
  1. In the event handler for the browser's Back button, you'll need this snippet:
        if (webBrowser1.CanGoBack) webBrowser1.GoBack();
    You'll need a similar approach for the Forward button.
  2. I used the webBrowser1_Navigating event handler to enable my Stop button and initialize the progress bar to 0. Sometimes you need to call the Invalidate() method to force controls to repaint when you make changes like these.
  3. I used the webBrowser1_ProgressChanged event to update the progress bar.
  4. I used the webBrowser1_DocumentCompleted event to stop all the stuff the above two event handlers were doing.
  5. Here's code to fill up the web browser with a web page:
       string url = "http://www.microsoft.com/";
       webBrowser1.Navigate(url);
    
    


Visitors: Hit Counter