Results 1 to 7 of 7

Thread: [RESOLVED] Constantly refreshing?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    23

    Resolved [RESOLVED] Constantly refreshing?

    I am using VB 2005 Express Edition.

    I posted a question before, about how to add a web page to a application.

    I was given the script:
    VB Code:
    1. WebBrowser1.Navigate("http://www.vbforums.com")

    But when I run the application, the page just keeps refreshing it's self.

    Any help is greatly appreciated.

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

    Re: Constantly refreshing?

    That line will load the specified URL into the browser control. That page has no autorefresh code on it so if the page keeps refreshing itself then you must be continually calling that method. Where exactly have you placed that code? Put a break point on it and see if it gets executed over and over. Click the line and press F9 to set a break point, then run your project.
    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

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    23

    Re: Constantly refreshing?

    VB Code:
    1. Public Class Form1
    2.  
    3.     Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    4.         WebBrowser1.Navigate("http://www.vbforums.com")
    5.     End Sub
    6.  
    7.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    8.  
    9.     End Sub
    10. End Class

    I just tried setting a brake point at " WebBrowser1.Navigate("http://www.vbforums.com")" But all it did was load the app, load the page, minimize it, and then turn the code yellow. When I tried maximizing the app, it appears blank?

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    23

    Re: Constantly refreshing?

    I'm going to get some sleep, I will check back in the morning.

    Thanks.

  5. #5
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Constantly refreshing?

    VB Code:
    1. Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    2.     WebBrowser1.Navigate("http://www.vbforums.com")
    3. End Sub
    Theres your problem. Everytime the Document finishes loading, you're making it load a new webpage (the same one). Move it from the DocumentCompleted method, and it should be fine.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

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

    Re: Constantly refreshing?

    So you now have your fix, which is why when something odd happens you should post the code you're using in the first place.

    As for the break point, that's what is supposed to happen. When execution reaches that line it breaks and enters the debugger. You were supposed to then press F5 or the Run button to start it again, at which point it would have broken again, and the cycle would continue, showing you that you were calling the same code over and over again. That was the point.
    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

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    23

    Re: Constantly refreshing?

    Thanks .

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