Hello,
Does anybody know a quick way to add the status bar to the bottom of the WebBrowser control? This would show status as the user loads another page.
Thanks,
Christian :wave:
Printable View
Hello,
Does anybody know a quick way to add the status bar to the bottom of the WebBrowser control? This would show status as the user loads another page.
Thanks,
Christian :wave:
Just add the web browser to you form, add a status bar to your form, add a panel to the status bar and write a line of code in the proper event of the web browser that shows the load time. It doesn't get much quicker than that.
to my knowledge there is no way to implement the IE status bar into your application.
You could implement your own status bar, and mimic IE's for the most part.. using properties like StatusText and the StatusTextChanged event, and the IsBusy property, etc...
Normally you'd add a StatusStrip and add a progress bar to it. You can then use the events of the WebBrowser, specifically ProgressChanged, to set the progress. The 'e' argument in the ProgressChanged event handler has CurrentProgress and MaximumProgress properties that you can use to set the corresponding properties of the progress bar. Just note that that event can give odd values when the document starts loading and when it finishes. I can't remember the exact details but you'll have to finesse things a little to prevent exceptions at those points. Just use a bit of trial and error to work out the issues. I did exactly that to answer basically the same question for someone else when I'd never used the WebBrowser before. I added Debug.WriteLine calls to write the CurrentProgress and MaximumProgress values so I could see where it went weird and work out what special cases I needed to allow for.
I was looking for an answer to the status bar problem myself, but have just discovered these two pages: they will do what you want:
http://www.planetsourcecode.com/vb/s...1819&lngWId=10
http://www.planetsourcecode.com/vb/s...1953&lngWId=10
Tim in Ireland :wave:
Thanks dude. The examples look very promising. :-)
'Progress1 = name of the ProgressBar in the StatusBar.VB Code:
Private Sub Webbowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles Webbrowser1.ProgressChanged Progress1.Visible = True If e.MaximumProgress <> 0 And e.MaximumProgress >= e.CurrentProgress Then Progress1.Value = Convert.ToInt32(100 * e.CurrentProgress / e.MaximumProgress) Else With Progress1 .Value = 0 .Visible = False End With End If End Sub
Radjesh Klauke,
You totally rock. I don't know how I missed that event. Thank you so much!
--Christian
that really helped me alot