Solved

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

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to dynamically set the form action using jQuery.
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.

856 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