?
Solved

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

Posted on 2009-05-04
1
Medium Priority
?
655 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
ID: 24298317
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month15 days, 1 hour left to enroll

840 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