• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

VB6 APP quiting at start up?

I have a VB6 app that I have been tweeking for quite some time.  All of a sudden either when I compile it and run it or just start it up from the code screen it abruptly ends.  If I start it in debug mode I will go so far and then click on the run button and then it loads.  I don't see anything that stands out that would cause this.  I am thinking maybe I inadvertently put some character in there that causes that but I don't see anything and it does compile.

Any ideas?  

1 Solution
You are gonna have to step through the program until the error occurs.
Mike TomlinsonMiddle School Assistant TeacherCommented:
That is a common symptom in applications with use subclassing or hooks that have an error somewhere in them.  Are you using either of these techniques?

Put some MsgBox calls in, and you can find out where it's crashing.

MsgBox "Program Started"
line of code

MsgBox "Step 1"

line of code
line of code

MsgBox "Step 2"

etc... ...
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Agree with Idle_Mind  and

in addition , in my experience this can happen if:

1: use of some API functions in general. trying to simulate multi threading.

2: Using poorly written C++ dlls ( are you using c++ dlls?)

3: using poorly developed  3rd  party activeX controls.


Note that removing this kind of bug is the hardest.

My suggestion is to:

Add logging  to every sub, function in your code.

so exatly before sub ends something like this:

open "c:\log.txt" for append as #1
print #1,"Procedure This_porcedue was successfull" & "|" & now( )

I know this method is tedious, but it is the only choice if  when you  disable the error handling
and still program crashes out without stopping at an error.

Mike TomlinsonMiddle School Assistant TeacherCommented:
In the past, when my subclassed apps crashed on load, it was commonly because I missed a variable or type declaration and I had Option Explicit turned on.

sjmmajorAuthor Commented:
It will take me a day to be able to check.  Thanks for the ideas.

Or sometime


will cause a problem

    You may also want to chack if you are calling anything (API, other modules, etc) that may not be returning fast enough when the program runs normaly but returns in time when you step through the code. I had that once.

sjmmajorAuthor Commented:
Thanks to all!  It actually ended up being the ADO refresh that was causing the problem.  It was trying to refresh the ADO before the form was loaded and it didn't like it.  Once I included the error handling for the ADO the problem cleared up.  
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now