I am currently makeing a web browser in VB express and at the bottem i wish to have a progress bar . i have the bar in place .... but i need a script or the code to get it to tell the user how much the browser has loaded. Also does anyone know how to make a tool bar ... e.g. File | Edit | veiw | Help etc.
I would be soooooo grateful ... thanks a bunch Rhys Durham

Progress bar
RalphTrent
Public Class Form1
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
End Sub
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.Navigate(TextBox1.Text)
End Sub
Private Sub ToolStripComboBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub GoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToolStripMenuItem.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub RefreshToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshToolStripMenuItem.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs)
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
So ... that peice of script you gave me ... where do i put it
Patrick_Kirk
M Gad
i revieved 3 errors
Error 1 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. C:\Documents and Settings\webmaster account\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.vb 8 99 WindowsApplication1
Error 2 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. C:\Documents and Settings\webmaster account\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.vb 12 111 WindowsApplication1
Error 3 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. C:\Documents and Settings\webmaster account\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.vb 16 116 WindowsApplication1
MarkAok
Your code is full of empty event handlers. Remove them. They are the ones that have no code in them :-)
You can paste that code anywhere, so long as it's not within an existing sub, or outside the class definition. Replacing the empty subs with the code you were given would be the easy way to do it.
TLJ
My reply was the best help anyone could give you. If, however, you don't want to learn how to program, the other answer that was offered is all that you need to fix your problem. You just need to copy and paste the methods into your code.
baldrick98007
Hi lildotti,
look, for the tool bar, or menu, you select MenuStrip from the toolbox(to view toolbox, click View in the main menu-->Toolbox)...
Now regarding the progress bar, use the following code on your form where you have already placed a Progressbar1, Webbrowser1, Button1, and TextBox1 :
Public Class Form1
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
ProgressBar1.Value = 100
End Sub
Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
ProgressBar1.Value = 0
ProgressBar1.Maximum = 100
Else
If ProgressBar1.Value + 1 > ProgressBar1.Maximum Then
ProgressBar1.Value = 80
End If
ProgressBar1.Value = ProgressBar1.Value + 1
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ProgressBar1.Value = 0
ProgressBar1.Step = 1
ProgressBar1.Maximum = 100
ProgressBar1.Style = ProgressBarStyle.Continuous
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
End Class
Good luck
MBMSMichael
Lildotti, Look what you will do:
add to your code what is written in green, and remove what is in red
Public Class Form1
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
End Sub
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.Navigate(TextBox1.Text)
End Sub
Private Sub ToolStripComboBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub GoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToolStripMenuItem.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub RefreshToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshToolStripMenuItem.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs)
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
ProgressBar1.Value = 100
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ProgressBar1.Value = 0
ProgressBar1.Step = 1
ProgressBar1.Maximum = 100
ProgressBar1.Style = ProgressBarStyle.Continuous
End Sub
Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
ProgressBar1.Value = 0
ProgressBar1.Maximum = 100
Else
If ProgressBar1.Value + 1 > ProgressBar1.Maximum Then
ProgressBar1.Value = 80
End If
ProgressBar1.Value = ProgressBar1.Value + 1
End If
End Sub
End Class
or you can copy and replace your code with the one above.
i agree with the comment of cgraus too.
Fulankazu
yes but where do i paste the code.
And im sorry if you took my last post the wrong way im just stressed because ive been looking through vb direcories all day .. sorry ...
i just need to know where to paste it
Paola80
dash it all ... i inserted the code .. tryed it out ,.. but i cant get it to actually work. I got no errors .. but the prgress bar just doesnt move .. ..
this is my code :
Public
Class Form2 Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickWebBrowser1.Navigate(TextBox1.Text)
End Sub Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)ProgressBar1.Value = 0
End Sub Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) If WebBrowser1.ReadyState = WebBrowserReadyState.Loaded ThenProgressBar1.Value = 0
Else If ProgressBar1.Value + 1 > ProgressBar1.Maximum Then ProgressBar1.Value = 0ProgressBar1.Value = ProgressBar1.Value + 1
End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadProgressBar1.Value = 0
ProgressBar1.Step = 1
End SubEnd
Class"You can probably see what i mean"
TommyKohler
1 - you should rename your variables to something useful
2 - if you can't work out how to use the sample you were given, that's a good sign that you're out of your depth. These forums are full of people ( most of them 'writing' web browsers, it seems ) who have downloaded an Express edition and are jumping in at the deep end. You should buy a book on VB.NET, which walks you through writing console apps, and learn some programming before you start worrying about controls, and event handlers and so on.
Stephane T.
asbuilts
Horus_Kol
Error Description:
"You did not supply a WithEvents variable in your Handles clause. The Handles keyword at the end of a procedure declaration causes it to handle events raised by an object variable declared using the WithEvents keyword."
Reference: http://msdn2.microsoft.com/en-us/library/32787dt6.aspx
Rhys, you need to revise the whole project step by step, i suggest that you start a project from scratch, design its interface, and then use our comments.
good luck
JodyC
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
You missed 'Handles webBrowser1.DocumentCompleted' on the end
Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs)
You missed 'Handles webBrowser1.ProgressChanged' on the end
The Handles statement hooks your code to an event that is fired by a control. Without it, the code is never called.