Home > programming > Visual Basic 6 on Win­dows 7: DBGrid32.ocx Issues

Visual Basic 6 on Win­dows 7: DBGrid32.ocx Issues

January 26th, 2012 Leave a comment

    Unfor­tu­nately, I’m one of those poor pro­gram­mers who is forced to main­tain some pretty old appli­ca­tions writ­ten in Visual Basic 6.  Thus, it was imper­a­tive to get the IDE work­ing on Win­dows 7. When I looked into this issue two years ago, I found an infor­ma­tive post cov­er­ing the basics over at Forty­Pound­Head. The instal­la­tion guide works pretty well except you don’t need to turn off UAC first. So here’s a short sum­mary on how to install VB6 on Win­dows 7.

    1. Cre­ate an empty file in your Win­dows direc­tory called MSJAVA.DLL. This is to skip the install of this very old MS Java thingy which even requires a reboot.
    2. Run setup.exe as admin­is­tra­tor and install the needed components
    3. Install the Ser­vice Pack 6
    4. Install the Visual Basic 6.0 Ser­vice Pack 6 Cumu­la­tive Update

    Step 4 is the cul­prit that breaks your DBGrid. It will cause your DBGrid con­trols to lose any infor­ma­tion like data sources, lay­out set­tings, and so on. So before you pro­ceed with step 4, make a backup of %windir%\system32\dbgrid32.ocx. After installing the SP6 Cumu­la­tive Update, replace the newly installed DBGrid32.ocx with the backup you’ve cre­ated ear­lier. Now reg­is­ter the OCX via regsvr32. Every­thing works fine again.

    Alright, this is a dirty hack. It’s def­i­nitely bet­ter to sim­ply get rid of this con­trol or even bet­ter yet – upgrade to a newer Ver­sion of Visual Basic. If you’re like me and you can’t migrate to a newer ver­sion though, it might help you get around this issue until you’ve replaced all the con­trols. Good luck!

    1. jo
      May 11th, 2013 at 07:11 | #1

      thanks a lot it works!!

    2. rahma
      August 21st, 2013 at 04:19 | #2

      can i get dbgrid32.ocx and dbgrid32.reg for vb6 on win­dows 7 with 32 bit oper­at­ing sys­tem, please send to rahmawatiekafitriani@yahoo.co.id

    3. Ralph
      January 27th, 2014 at 18:00 | #3

      Super.  Worked like a charm.  Thanks

    1. No trackbacks yet.