Two IE Browser Controls showing two different webpages

Posted on 1999-12-17
Medium Priority
Last Modified: 2010-05-02
Can someone show me the code required to have 2 IE Browser Controls on the form, each with a different URL appearing.
A side request would be to tell me any way to make those URL's undetectable. (ie. right click, properties).
Question by:rbend
  • 2
LVL 14

Accepted Solution

mcrider earned 200 total points
ID: 2291689
There is a problem with the browser control.  It will not allow more than one browser control on a form... However, you can get around this.

This is going to get complicated real quick... Please do everything exactly as you see it in the example...

1) create a new project.

2) add the webbrowser control to the project.

3) add a webbrowser control to Form1 and call it WebBrowser1.

4) add a new form to the project and call it Form2.

5) add a picture control to Form2 and call it Picture1.

6) add a webbrowser control inside Picture1 on Form2 and call it WebBrowser2.  This webbrowser control MUST be a child of the picturebox.

7) add the following code to the DECLARATIONS Section of Form1:


    Public eFrame As Object
    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    Private Sub Form_Load()
        Load Form2
        Set eFrame = Form2.Picture1
        With WebBrowser1
            .Top = 0
            .Left = 0
            .Height = Me.Height / 2 - 420
            .Width = Me.Width - 120
            .Navigate "www.caas.com"
        End With
        With eFrame
            .Top = WebBrowser1.Height
            .Left = 0
            .Height = WebBrowser1.Height
            .Width = WebBrowser1.Width
            Form2.WebBrowser2.Top = 0
            Form2.WebBrowser2.Left = 0
            Form2.WebBrowser2.Height = .Height
            Form2.WebBrowser2.Width = .Width
        End With
        Form2.WebBrowser2.Navigate "www.yahoo.com"
        SetParent eFrame.hWnd, Form1.hWnd
    End Sub

8) Run the program... in form1, you will see 2 browser windows...  The top browser will be my company's web page and the bottom will be yahoo!



Author Comment

ID: 2305412
thanks as always mcrider..
LVL 14

Expert Comment

ID: 2305433
Glad I could help! Thanks for the points!


Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question