Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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