• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

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

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 !

Susan
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

0
DistributedServices
Asked:
DistributedServices
  • 3
  • 2
  • 2
1 Solution
 
elimesikaCommented:
Should be:
Dim o_IEarray(3) As InternetExplorer

Open in new window

0
 
Wayne Taylor (webtubbs)Commented:
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
        IEList.Add(IE)

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

Wayne
0
 
Wayne Taylor (webtubbs)Commented:
sorry, just realised your are using VB6. Ignore my comment above.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
DistributedServicesAuthor Commented:
Hi elimesika !

Of cause that work's but how do I get the events?
0
 
elimesikaCommented:
0
 
DistributedServicesAuthor Commented:
Thank you, elimesika, for your help about raising events in VB6.

On http://www.codeguru.com/columns/vb/article.php/c6557 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

???
0
 
elimesikaCommented:
Sorry for the delay (have lot of work to do), will look at it ASAP...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now