I am in the process of developing an application that uses a webbrowser control to display google maps. when I load the maps under IE6 I notice that the status bar displays something like "(x Remaining Items) Downloading Picture http://...." x is the number of items being loaded and decrements to 0. I am wondering if there is a way to display this same kind of status with my webbrowser control. i currently have a status bar attached to the main windows form that uses the standard code shown below. the current status bar only shows status until the main page is loaded. If someone could get me started in the right direction or provide a code snippet i would appreciate it.
Thanks
Jim Groleau
Private
Sub WebBrowser1_Navigating(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating 'Me.lblApplicationStatus.Text = "Navigating to: " + e.Url.Host.ToString() End SubPrivate
Sub WebBrowser1_ProgressChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged If e.CurrentProgress < e.MaximumProgress Then If pbStatus.Value >= pbStatus.Maximum ThenpbStatus.Value = pbStatus.Minimum
ElsepbStatus.PerformStep()
End IfpbStatus.Value = pbStatus.Minimum
End If End Sub Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted If My.Application.Info.Title <> "" Then Me.Text = My.Application.Info.Title + " - " + e.Url.Host.ToString() Else Me.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName) + " - " + e.Url.Host.ToString()MsgBox(
Me.WindowState.ToString()) End If Me.lblApplicationStatus.Text = "Ready" End Sub
Webbrowser control (x reamaining items) status bar implementation
cmwith
Oh yes,
For VB...
You can just select WebBbrowser1 (from General) and then select StatusTextChagnged( from Declarations) ...
Then you should have following code...
Private Sub WebBrowser1_StatusTextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebBrowser1.StatusTextChanged
Label1.Text=WebBrowser1.StatusText ;
End Sub
For C#
As given in old post.
Thanks
Antonio Neeves
Sorry for the delay. I just had a chance to try your solution. It works great thanks.
Jim G.
Muhsin Zahid U&#287;ur
Hi,
Simply register following event and…
public Form1()
{
InitializeComponent();
webBrowser1.StatusTextChanged += new EventHandler(webBrowser1_StatusTextChanged);
}
Handle like this…
void webBrowser1_StatusTextChanged(object sender, EventArgs e)
{
label1.Text = webBrowser1.StatusText;
}
Hope this help.
Grotius
Mubshir,
You don't have to register the event in VB.