Debugging a VB6 OCX in a VB6 project

I'm trying to debug a VB6 OCX (activeX) in a VB6 project and I can't get it working. I have the OCX and the project file. I create a new project with a blank form and add the OCX component and I can't step into it. If I open up the project and add a form and then try to debug it, it doesn't run.

Whats the correct way to debug this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shahid ThaikaSole ProprietorCommented:
Do you have the source code of the ocx and the project opened along with your executable project? If yes add the following statement... 'debug.assert false' one line before the code where you want to debug. The VB compiler should break at this point.
You need to have both projects loaded at the same time:

Start VB.
Open the project for your Active X Control.
The in File Select Add Project.
Start a new standard project.
Right click on the new project and select Set as Startup
make sure that the form for the Active X Control project closed (project still loaded - just close the form).
Open the form from the new project and add the Active X control (you may need to compile the control first)
Set your breakpoints
Now when you run - it will allow you to enter the code of the control.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sparky191Author Commented:
I was already trying it with both projects open and the ocx on the new form, but it wouldn't step into the code. Someone elsewhere suggested I should add the vbp rather than the ocx as a component. This intially apeared as an option and then disappeared and now has reappeared so I  did that and its now working. But I didn't know about the  "Set as Startup" so I'll try that with a new project and see if it works.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

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.