I installed Windows 7. After installation of Visual Basic 5 I cannot manage to add components like the Microsoft Data Bound Grid Control (DBGRID32.ocx) and all the rest of the .ocx type controls. The error message is either "Permission denied" or "error accessing the register". Has anyone a solution other than renouncing Windows 7?

Dani AI

Generated

A few extra, practical steps that go beyond the compatibility/run-as-admin trick already suggested by and others. If you still get "Permission denied" or registration failures when adding DBGRID32.ocx (or other OCXs), the problem is most often about how the control is being registered or about missing native dependencies — not the VB IDE itself.

If Windows is 64-bit, register 32-bit OCX files with the 32-bit regsvr32 from SysWOW64 (yes, the names are confusing). Open an elevated command prompt and run something like:

rem run an elevated cmd (right-click -> Run as administrator)
cd \Windows\SysWOW64
regsvr32 "C:\Path\To\DBGRID32.ocx"

Use regsvr32 /u first to unregister any old copy before re-registering. If regsvr32 reports "DllRegisterServer not found" or a similar error, the file might not be the right type/bitness.

If registration still fails, check for missing DLL dependencies (common cause). Use a tool like Dependency Walker or the modern alternatives to inspect the OCX and confirm every dependent DLL is present. Also use Process Monitor (ProcMon) to watch for ACCESS DENIED or file-not-found while regsvr32 runs — it will show whether UAC/permissions or a missing file is the culprit. Event Viewer can also show side-by-side or registration errors.

If the control is a 16-bit VBX or otherwise incompatible with x64, or if dependencies are old and hard to satisfy, consider running VB5 inside a Windows XP VM / XP Mode as does, or build an installer that places and registers the OCX on target machines. Always keep backups and only register controls from trusted sources.

Recommended Answers

All 10 Replies

Try uninstalling VB5 and then re-installing it as Administrator. This may solve your problem, it has done for similar issues I have had.

Exactly the same problem with me and I did install VB as Administrator and, just to make sure, re-installed it. But it didn't help.

Would really appreciate any other ideas.

More than likely the same problem as other very old compilers, such as vc++ 6.0. Upgrade the compiler -- VB 2008 Express is free, but I don't know if that version will do what you want it to do.

Excuse my lack of in depth knowledge but the problem arises before I get to the stage of running the code I've written, so is the compiler involved?

Just like CorradoC, I get the error after opening a project and then trying to add the DBGRID control. VB's Help gives several explanations but the only one that seems likely is 'You attempted to access the registry, but your user permissions don't include this type of registry access.' I'm set up as Adminstrator. So, any ideas?

I was unable to run Visual Basic ver. 4 ("OLEPRO32.DLL could not be registered") and several other old programs. Cured some of them by using Windows Explorer to find the executable file (e.g., VB.EXE), right clicking on the file, clicking on Properties, click on the Compatibility tab and checking both "Run this program in compatibility mode for Windows XP (Service Pack 3)" and the "Run this program as an administrator".

Thanks. Big step forward. The compatability bit was already set but Run as Administrator did the trick. I can now place the DBGRID control on a form, save the project, restart VB5 and open the project again.

But if I try to open an old project (developed under XP) I get an error and in the log file is "Class MSDBGrid.DBGrid of control dbg...... was not a loaded control class." I guess I could replace all the DBGRIDs on the forms but there's lots of them.

Anyone know of a quicker way?

I managed to answer my own question - just remove the offending forms from the project, add the DBGRID control and add the forms back in. Save the project and next it opens OK. So many thanks to Gareldmce!

This still won't work for me. Any tips?

I do all my VB5 development in XP window on Windows 7, I don't have any problem. If you generate and install set for your application, then it will install and run on Win 7 pcs. As you can see from a post I have just made application mostly runs on win 8.

I was having the same problem and solved it by doing exactly what you said: Using Windows Explorer to find the executable file (e.g., VB.EXE), right clicking on the file, clicking on Properties, click on the Compatibility tab and checking both "Run this program in compatibility mode for Windows XP (Service Pack 3)" and the "Run this program as an administrator. Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.