|
-
Jul 13th, 2009, 10:41 AM
#1
Thread Starter
Addicted Member
HELP Progress bar
hi im a newbie i use visual studio 2008 i have a problem i finally got the progress bar to work but i want it to stop when the website i choose to display is fully loaded can anyone help me here is my code below
Public Class Form1
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.GoBack()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.GoForward()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
WebBrowser1.Refresh()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
WebBrowser1.Stop()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
WebBrowser1.GoHome()
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.MouseClick
PrintDialog1.ShowDialog()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then Button1.PerformClick()
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Increment(1)
If Timer1.Enabled = True Then
ProgressBar1.Value = 0
End If
If Timer2.Enabled = True Then
ProgressBar1.Value = 100
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
End Class
Last edited by pillhead2007; Jul 17th, 2009 at 05:36 PM.
-
Jul 13th, 2009, 10:50 AM
#2
Re: HELP Progress bar
If you double click your webbrowser control in the designer it will create and take you to the DocumentCompleted event handler. This event is fired each time the browser control finishes loading a page, so simply stick the code in here that stops your progress bar (ie progressbar1.Value = 0 or whatever)
-
Jul 13th, 2009, 10:57 AM
#3
Re: HELP Progress bar
Told you in the other thread. In the webbrowser's DownloadComplete event, do what you need to do to the progress bar, most likely setting its value to 0
-
Jul 13th, 2009, 10:58 AM
#4
Re: HELP Progress bar
 Originally Posted by stateofidleness
Told you in the other thread. In the webbrowser's DownloadComplete event, do what you need to do to the progress bar, most likely setting its value to 0
Its DocumentCompleted not DownloadComplete
-
Jul 13th, 2009, 10:59 AM
#5
Thread Starter
Addicted Member
Re: HELP Progress bar
thank you so much chris and ste offidleness if you did say that coz i probely didnt completely understand what you meant sorri thanks chris
-
Jul 13th, 2009, 11:02 AM
#6
Thread Starter
Addicted Member
Re: HELP Progress bar
it has worked but how do i get the progress bar to work with the refresh button mate if you know how to as i say im a total newbie at this
-
Jul 13th, 2009, 11:22 AM
#7
Re: HELP Progress bar
the DocumentComplete event won't take into consideration pages with frames. It will fire after each frame is loaded. the DownloadComplete event will only fire once, once the entire page (all frames) are completely loaded. Thus, giving a better status indicator of when the page is "loaded."
refreshing should produce the same result. if you set progressbar's value back to 0 after each load, then on the next load it will start at 0 and be set to full again in the DownloadComplete event.
-
Jul 13th, 2009, 12:02 PM
#8
Re: HELP Progress bar
There is no DownloadComplete event on the .NET Webbrowser control as far as I can see...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|