Solved

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

Posted on 2009-05-04
1
645 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
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.

896 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

16 Experts available now in Live!

Get 1:1 Help Now