[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:
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.
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.
Re: Constantly refreshing?
VB Code:
Public Class Form1
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
WebBrowser1.Navigate("http://www.vbforums.com")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
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?
Re: Constantly refreshing?
I'm going to get some sleep, I will check back in the morning.
Thanks.
Re: Constantly refreshing?
VB Code:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
WebBrowser1.Navigate("http://www.vbforums.com")
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
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.
Re: Constantly refreshing?