Library tutorials & articles
WebBrowser Control
- Introduction
- The Basics
- Going Further
- More Navigation
- Browser Commands
More Navigation
You will have noticed that in explorer, there are far more buttons than just Back and Forward, so lets add them now. Alongside the first 2 buttons (forward and back) place four new command buttons called cmdstop, cmdhome, cmdsearch and cmdrefresh. In the caption properties, call them stop, home, search and refresh (or something else if you want). Double click on each of them and add the following code for each button….
HOME
WebBrowser1.Navigate "http:\www.thtproductions.co.uk"
STOP
WebBrowser1.Stop
SEARCH
Webbrowser1.gosearch
REFRESH
Webbroswer1.stop
Now then You by now have noticed that if you resize the for the web browser window doesn’t resize with it. To get this to work, all you need to do is type in the code below into the Resize event of the Form, and the window will resize automatically with the window.
WebBrowser1.Move 0, 0, ScaleWidth, ScaleHeight
You can also simply set the Width and Height properties instead, if you wish.
However, now you will notice the problem below:
It would seem only way to get around this is to pull the webbrowser window to the top of the form as high as it will allow (i.e. the top of the browser window meets the part of the form with the little icon and the name of the form in the little bar.) But then when you run the program again you will find that the buttons are over the web browser window. Bummer. Never fear Paul is here. In order to get things right again all you need to do is to take into account the space taken up by the buttons and combo box when the form is resized. To do this, all you need to do is change the code in the Resize event to
'resize the webbrowser control to fill the window (ScaleWidth and ScaleHeight)
'840 is the space taken up by the buttons!
WebBrowser1.Move 0, 840, ScaleWidth, ScaleHeight - 840
Simple!
Related articles
Related discussion
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
-
Can you describe Above simple VB6 code?
by pramodmca09 (0 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Comments
Leave a comment
Sign in or Join us (it's free).