Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 73,682 times

Contents

Related Categories

WebBrowser Control - More Navigation

Paul Hughes

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!

Comments

  • Re: [18] WebBrowser Control

    Posted by DeviledGod on 02 Jul 2008

    Hi...I want some help about WebBrowser controls. More specifically i want to know how the URL textbox changes and gets the Browser's URL.


    When i click a link...

  • Re: [18] WebBrowser Control

    Posted by borqom on 06 May 2008

    Hi, As i know so far there is no go button, to create a button that takes you to a link you have to use a textbox (txtLink) and a button(btnlink) controls.


    I...

  • Re: [18] WebBrowser Control

    Posted by OsamaPs on 17 Jul 2006

    hi


    it is a great browser :D


    but where is th GO button?!!?!

  • Posted by ooo on 07 Nov 2005

    hey try to be more discrete i know hwo u are :)

  • Command in webbrowser

    Posted by Mikey123 on 05 Oct 2005

    Hi,
    I have created a web browser for it to load tankmania.com but what i need to know is how do i get a button to interact with the web browser eg: I click the button and it send a keyboard event to ...