Results 1 to 9 of 9

Thread: VS 2005 WebBrowser?

  1. #1

    Thread Starter
    Fanatic Member cpatzer's Avatar
    Join Date
    Sep 2004
    Posts
    537

    Question VS 2005 WebBrowser?

    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
    In life you can be sure of only two things... death and taxes. I'll take death.

  2. #2
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: VS 2005 WebBrowser?

    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.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: VS 2005 WebBrowser?

    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...

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: VS 2005 WebBrowser?

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    New Member
    Join Date
    May 2006
    Posts
    13

    Thumbs up Re: VS 2005 WebBrowser?

    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

  6. #6

    Thread Starter
    Fanatic Member cpatzer's Avatar
    Join Date
    Sep 2004
    Posts
    537

    Re: VS 2005 WebBrowser?

    Thanks dude. The examples look very promising. :-)
    In life you can be sure of only two things... death and taxes. I'll take death.

  7. #7
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: VS 2005 WebBrowser?

    VB Code:
    1. Private Sub Webbowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles Webbrowser1.ProgressChanged
    2.     Progress1.Visible = True
    3.  
    4.     If e.MaximumProgress <> 0 And e.MaximumProgress >= e.CurrentProgress Then
    5.             Progress1.Value = Convert.ToInt32(100 * e.CurrentProgress / e.MaximumProgress)
    6.     Else
    7.         With Progress1
    8.             .Value = 0
    9.             .Visible = False
    10.         End With
    11.     End If
    12. End Sub
    'Progress1 = name of the ProgressBar in the StatusBar.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  8. #8

    Thread Starter
    Fanatic Member cpatzer's Avatar
    Join Date
    Sep 2004
    Posts
    537

    Re: VS 2005 WebBrowser?

    Radjesh Klauke,

    You totally rock. I don't know how I missed that event. Thank you so much!

    --Christian
    In life you can be sure of only two things... death and taxes. I'll take death.

  9. #9
    New Member
    Join Date
    Jun 2006
    Posts
    1

    Re: VS 2005 WebBrowser?

    that really helped me alot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width