How can I put, and use, a progress bar for my web browser control, in a windows application project, using the c# language?
The WebBrowser control has a ProgressChanged event:
You need to attach an event handler to the ProgressChanged event:
WebBrowser1.ProgressChanged += WebBrowser1_ProgressChanged;
This is shorthand for:
WebBrowser1.ProgressChanged += new WebBrowserProgressChangedEventHandler(WebBrowser1_ProgressChanged);
The compiler will infer the handler and add that at compile time.
Next, implement the handler:
private void WebBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e) {
ProgressBar1.Value = e.CurrentProgress;
}
The WebBrowserProgressChangedEventArgs type supports a CurrentProgress property which reflects the current state of the browser control's progress.