troubleshooting Question

Dealing with events in child documents in Visual Basic 6.0

Avatar of scottmichael2
scottmichael2 asked on
Visual Basic ClassicMicrosoft Development
4 Comments2 Solutions260 ViewsLast Modified:
It's easy enough to implement a single DOM object with events in Visual Basic, but what if the document has child documents in frames and you aren't sure how many?

Here's the situation: I am dynamically reading/modifying web pages with mshtml.  Some pages, however, have multiple child documents in frames.  The current solution that I've implemented is to create 10 HTMLDocument objects and load however many child documents that exist (assuming no more than 10).  This allows me to trap events from each one.  Is there a way to dynamically create an event procedure since I don't know how many children there are?

Dim WithEvents mdoc As HTMLDocument
Dim WithEvents mdoc1 As HTMLDocument
Dim WithEvents mdoc2 As HTMLDocument
Dim WithEvents mdoc3 As HTMLDocument
Dim WithEvents mdoc4 As HTMLDocument
Dim WithEvents mdoc5 As HTMLDocument
Dim WithEvents mdoc6 As HTMLDocument
Dim WithEvents mdoc7 As HTMLDocument
Dim WithEvents mdoc8 As HTMLDocument
Dim WithEvents mdoc9 As HTMLDocument
Dim WithEvents mdoc10 As HTMLDocument

I set the first one to the parent document and create the events for it.  Then I create all the events for all of the children and then implement however many children that are contained in frames in the parent (up to 10).  Is there a way to dynamically catch the child events intead of doing it this way?

Thanks,
Scott
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros