how to have an array of browsers in VB (Dim WithEvents o_IE As InternetExplorer / Set o_IE = New InternetExplorer)

Posted on 2009-07-05
Last Modified: 2013-12-26
Hello !

I have a project controlling IE. So far it works fine.
Now I want to add a second instance (or even several).

I was wondering if I can put them all into an array (and how).

Thank you for any idea !

Dim test(3) As String; <- works
Dim WithEvents o_IE As InternetExplorer;<- works too
Dim WithEvents o_IEarray(3) As InternetExplorer ,<- does not (syntax error, expecting AS)

Open in new window

Question by:DistributedServices
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
LVL 19

Expert Comment

ID: 24779326
Should be:
Dim o_IEarray(3) As InternetExplorer

Open in new window

LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 24779472
If you have an array of InternetExplorer's, don't use WithEvents, but add your event handlers with AddHandler.

Also, I would use a generic list, of type InternetExplorer....

        Dim IEList As New List(Of InternetExplorer)
        Dim IE As InternetExplorer '= however you get the IE object
        AddHandler IE.DocumentComplete, AddressOf IE_DocumentComplete

...where IE_DocumentComplete is the routine to handle the DocumentComplete event of the IE object.

LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 24779486
sorry, just realised your are using VB6. Ignore my comment above.
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.


Author Comment

ID: 24782864
Hi elimesika !

Of cause that work's but how do I get the events?
LVL 19

Accepted Solution

elimesika earned 500 total points
ID: 24783005

Author Comment

ID: 24791924
Thank you, elimesika, for your help about raising events in VB6.

On I did not find, how to receive an event (normally a function is been called when an event raises).  

Do you have any idea how to dim an array of browsers with events, like

Dim WithEvents o_IEarray(3) As InternetExplorer

LVL 19

Expert Comment

ID: 24803230
Sorry for the delay (have lot of work to do), will look at it ASAP...

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

738 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