Solved

VB6: Web Browser Control run-time error "-2"

Posted on 2009-05-04
1
644 Views
Last Modified: 2013-11-19
I am using a Web Browser control in VB6, and it consistently gives me a Run-time error with an error number that is always negative, small, and even (-2, -4, -6, etc.).  Even though I have placed an ON ERROR directive in every routine involving the browser, I consistently get this Run-time error without the opportunity to capture the error and debug the code: the dialog box gives me only an OK and Help button: pressing Help does absolutely nothing; and pressing OK terminates the program.  Using the Web Browser is the place and time that I experience this peculiar behavior, and it happens with great consistency.  
I am more than willing to share more information and, if ncessary, upload the program on EE's web site for perusal.  For my first pass, I'll simply ask if any of you have ever encountered this error before, and what you've done.
Thanks, ~Peter Ferber
RuntimeError.bmp
0
Comment
Question by:PeterFrb
1 Comment
 

Accepted Solution

by:
PeterFrb earned 0 total points
Comment Utility
I've answered my own question!  I had a "clean-up" routine to finish off some processes.  As browsers are more prone than most objects to interrupting a given event to perform some more recent event, I believe my code put itself into a loop.  It successfully navigated to the first site, but it was in trouble at that point; and with the next navigation, it gave the error shown above.  
As a general rule, I would say to be very careful to code each event process very specifically, and don't, if possible, have events calling one's own contained routines.  In the event that another event arbitrarily interrupts the self-contained routine, the results will be sporadic, unpredictable, and prone to untrackible errors.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now