New Stuff
« Easy 1-2-3 for Turning Off Auto-Play On Facebook Videos (Kim Gentes/Worship Tech Blog) | Main | Worship Backing Band - Musicademy (Kim Gentes/ Worship Tech Blog) »

Loading & Using VisualBasic 6 Legacy Projects on Windows 7 - How To Register Legacy Typelibs on Modern Microsoft OS (Kim Gentes/Worship Tech Blog)

This tech blog post will be for the programmer geeks out there.

Recently, I have had to go back to reinstalling Visual Basic 6 on a Windows 7 workstation and trying to do some development/bug fixes. Specifically, I have been trying to get my dev environment working to debug some old VB6 OCX projects. After working through some initial lameness with installing VB6 (for example, it will always try to install an old version of Java on a new Windows machine- you can trick it out of doing that), I final got VB6/studio installed and could open my old VB6 project. A few more obvious issues after that, I was down to one error that I couldn't seem to solve.

The Problem

When I opened any of the VB6 projects, I got the same series or errors trying to load the project.  I have included the screen shots in detail here so you know exactly what I am seeing. I went through various Google and MSDN recommendations but nothing was working and I did not find a solution. Here were the errors I was getting:

 

Object library not registered

 

...continue loading project?

 

Errors during load. Refer to '<path>.log' for details.

 

Errors occurred during load.

 

Errors during load. Refer to '<path>.log' for details.

 

The project finally appeared, but without some of the MS Controls that I had used in the project.

 The error log file referred to in the screen shots contained this kind of error in my project (yours will vary):

Line 12: Class MSComctlLib.Slider of control sldInterval was not a loaded control class.

Line 37: Class MSComctlLib.Slider of control sldCallTimeout was not a loaded control class.

Line 54: Class MSComctlLib.Slider of control sldConnectTimeout was not a loaded control class.

Line 71: Class MSComctlLib.Slider of control sldTimeoutPeriod was not a loaded control class.

Line 88: Class MSComctlLib.Slider of control sldRetryPeriod was not a loaded control class.

 

The real problem? The Microsoft Visual Basic 6.0 Common Controls ( MSCOMCTL.OCX ) was not properly registered. OK. No problem, I thought. So, I quickly went to my Windows/SysWow64 directory and I registered it by running:

> regsvr32 mscomctl.ocx

from the command line (as Administrator). Command shell responded that .ocx was registered successfully. Woohoo!

Only, once I re-loaded the VB6 project, I got the same error as before: "Object library not registered"

So, I thought I might have to force VB6 studio to re-associate with the OCX so I attempted to add the mscomctl.ocx file to the project via the Components menu in the IDE. No tamales. Response: "Object not registered".  I even tried reinstalling VB6. No dice either. Bummer.

The Resolution

As I said, re-registering the OCX or reinstalling VB6 didn't help.

Back to Google and MSDN. I found a couple articles online that said to re-register the typelib as follows for Windows 7--

> cd C:\Windows\SysWOW64\

> regtlib msdatsrc.tlb 

This apparently works on some computers, but on my machine as the "regtlib.exe" executable was not present in the SysWow64. In fact, that file as an exe does not exist on my machine. After a bit more searching, I found that the type library registration is now part of .NET framework. I had to use that equivalent binary inside of one of my installations of .NET to do the task. On my machine, the solution was as follows:

> cd C:\Windows\SysWOW64\

Once there, I ran the regtlib command from the .net version that is installed (latest) on my machine.

> C:\Windows\SysWOW64]C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regtlibv12.exe msdatsrc.tlb

Registration of msdatsrc.tlb successful.

This command ran successfully and now I can open my VB project.  Zippidee doooda! Now my VB 6 project loads successfully.

Since this took me a while, I assumed others may have run into this gauntlet, so I wanted to be sure to document the fix in case anyone else runs into this.

 

Keep on coding people...

Kim Gentes

 

 

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments (7)

great

February 25, 2015 | Unregistered CommenterBose

Dear Kim,
Thank you soooo much!!

February 28, 2016 | Unregistered CommenterDieter Huskes

Dear Kim,

Thank you very much. I was pretty sure to go through the whole process, as you did. But lucky me, this was not necessary ;-).

Got it running on a Virtual Machine in Win7 and VB 6 by your final "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regtlibv12.exe msdatsrc.tlb"

Great!
Frederik

March 30, 2016 | Unregistered CommenterFrederik

Thanks Kim,

I looked around very much before finding the solution in your article. Thnks.

July 26, 2016 | Unregistered CommenterSumit

Good on You Kim,
Found your post after struggling for 7 hrs, finally issue ben resolved.

Thank you.

December 18, 2018 | Unregistered CommenterSuresh

glad this is helping, Suresh. Thanks for the note..

December 21, 2018 | Registered CommenterKim Gentes

YOU ARE A GOD SEND !

December 7, 2019 | Unregistered CommenterJ.Skar

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>