VB6, Windows 7, Good or No Good?

Level:
Level1

Don’t tell me all my hard work down the drain!!!

imageWindows 7 was released to the general public by Microsoft in October of 2009 (my how time flies). Since that point many home users and even more businesses have been upgrading their PC’s to make use of this solid Windows platform. Most people are in agreement that Windows 7 is head and shoulders above Windows Vista. This makes sense because with Vista Microsoft focused a lot of time and energy on adding “cool new features” whereas the Win8 focus was on compatibility with previous applications and hardware and better security, usability, and performance.

So where does that leave us? The great news for us Visual Basic 6 developers is that since Microsoft focused so heavily on compatibility, all of your VB6 apps will work straight out of the box. This is by far one of the greatest benefits us Windows developers have over Mac or other operating systems. Year after year Microsoft comes out with great applications and operating systems that push the envelope of what the hardware can handle and along the way they carry all of our “legacy” VB applications along on the wave.

What’s different?

Some great new things that Windows 7 brings to the party are its new shell, its slick taskbar (now called the Superbar), and it’s easy to set up network support. The other important thing is what is not there. With this release they quit packaging all the extra apps that no one ever used (such as calendar, mail, chat, etc.). Note you can still download them if you want but they won’t be installed by default. If your VB application made use of any of these “out of the box” apps you will want to now check if they are installed and if they are not provide a link to the Windows Live Essentials suite that your customers can use to download that much needed program.

What about the IDE?

imageSo my VB apps will run with no problem on the new Win7 boxes but what about the Visual Basic 6 IDE? You know the thing I still have two normal CD’s sitting a hug box with the original “programmers guide” that collects dust on my shelf? Just like the programs you developed, the VB IDE will run with no problems on Windows 7. You might see a notice as you install it that there could be compatibility defects, but I have been running it for over a year without a single issue. So don’t stress about upgrading your home or business personal computer. You will be able to continue to run that slick and simple VB Integrated Environment.

Be very, very careful

Now that we know our great Visual Basic applications can live on past 2010 and we know we don’t need to send an email to all our clients telling them not to upgrade what things should we be careful of as we continue to develop in VB6? Or what things should we check in our released applications to verify they still work.

The main things to focus on are exactly what you would expect – what common sense would tell us. For example if you have any VB6 API declarations you call directly you might want to verify that they still function the way you would expect (hint 99% of the time they do because they are the same API’s every C, C++, VB, Delphi, and any other windows application hit). The other areas you want to check out are any that do “non-standard” windows behavior. For example if you did a bunch of tricks to make a label cover part of the title bar it might be screwed up with the new chrome and title area. Same goes for taskbar or toast popups.

Make my VB apps not look so old

The last thing you might want to consider with a new release of Windows being out is how you can upgrade the look and feel of your applications to make them blend in more with the Win7 look. The best thing you can do is install Windows 7, play around with some of the applications that “fit” with the new look, then run your application and see what stands out like a sore thumb. Write everything down, prioritize it, and then get to work. Many times with just a feel tweaks to your color scheme, icons, and layout you can get that “old” app looking pretty spiffy.

How about you? Please post a comment if you have had luck running your VB6 applications on Windows 7 (or if you haven’t had luck feel free to vent to us).

Our VB6 on Windows 7 Tests

Everything I’ve mentioned so far is well and good but how about some details. Below I have the results of me trying our top 5 VB Applications and code snippets on this site. I ran all of these on a Windows 7 box in the VB6 IDE. With nothing special done (except for running in Admin mode as noted in the comments below). See for yourself how Windows7 handles VB 6.

1) VB6 type ahead combobox: This tutorial has been wildly popular at our site primarily because it gives a great introduction to a common VB control. Not only does it introduce this simple control it builds upon it to build one of the most useful and “fancy” features around (similar to what Google now has – but years ahead). Here it is running on Windows 7 with no problems whatsoever:

image

Status: Success

 

2) VB6 pdf tutorial: This tutorial allows you to create PDF files from within Visual Basic with out any third party controls. It makes use of only one .bas file that can be called into for all your PDF needs. One note on this sample. If you run it not in Admin mode you will see this message box when you click the button:

image

This is because the sample tries to save the pdf file in the same location the program is running. You can solve this by either running in admin mode or by changing the code to write the file to an allowable area (such as my documents). After you do this you can open the file and see:

image

Status: Success

 

3) VB6 Number Format: This tutorial walks through different ways you can format numbers, currencies, and percent's. It is a simple example that exercises all the different number related functions

image

Status: Success

 

4) VB Calculator Sample: When learning a new programing language a common first application to write is the classic calculator. This is also a great application to verify on Windows 7 as it not only uses many of the built in VB functions, but it also makes use of the standard windows controls.

image

Status: Success

 

5) VB Date Functions: Another set of functions that are used often when writing Win programs are the Date and Time functions. We put the sample code from this tutorial to the test and discovered that once again it all worked great!

image

Status: Success

 


Although we didn’t cover every tutorial and source sample we have on this site, virtually all of our VB6 Tutorials and VB6 source samples will work great on Windows 7. Go check them out and please report back in the comments section below if you find any issues.

If you enjoyed this post, subscribe for updates (it's free)

VB6 and Vista, Win 7,8 Compatibility issues

Our original VB guy has developed health issues. and can no longer work -
Original PC Timeclock was Bullet-Proof on XP - but later OS's gave following errors:

"Form Daysheet Not Available Due To Error D at position 866732 trap number 1125 type mismatch"

"Form not available due to error 153 at position 86206 trap number 5402 component calenderctl.ocx or one of its dependencies not correctly registered: a file is missing or invalid"

Using 'Compatibility Mode's was only MINOR help. VB Guy was in process of converting to use SQL Drivers. PLEASE HELP - these problems are apparently rampant for MANY usimg VB Apps, not just us. Is there ANY reliable way to 'fix' these probs - short of a total re-write in a different language ?!?

THANK YOU!

Do you still use VB6 in the USA!

hi
Sorry if I did not choose the right place for this comment.
mohammad in iran
1-Do you still use VB6 in the USA?
2-Do you still have to pay to use VB6?
3-For some reason (Sanctions - Iran's rejection of international copyright software - not presentation software in India), we'll copy of all software.Is our software for sale outside the country where the copy is written compilers will have a legal problem?

Firma:
Iran is a beautiful country or the usa in your opinion?

VB6 macro that works in XP won' work in Windows 7.

The following code in VB6 used to work fine when our company had installed XP in all PC's. Now they installed Windows 7 and this macro will not work. The purpose of the code is to start Explorer, direct it to a company link which shows an HTML form, then the code enters a string variable into an input box in the form and clicks a Submit button on the same form.

In W7 it crashes right after bringing up the form in Explorer. The link opens but then the process just stops. In VB debug run mode it crashes, with the following message "automation error - unspecified error" or if I run it in step debug mode using F8 key, I cannot proceed beyond the .Navigate line after the link has opened in Explorer, without re-clicking into the VB window, and when I do that and execute next line with F8 I get "automation error - the object invoked has disconnected from its clients."

Here is the code used in XP. I removed the actual link text since it is company private. The text to enter is variable "InputString":

Sub Open_Form_And_Input_Text(InputString)

Dim objIE As SHDocVw.InternetExplorer 'microsoft internet controls (shdocvw.dll)
Dim htmlDoc As MSHTML.HTMLDocument 'Microsoft HTML Object Library
Dim htmlInput As MSHTML.HTMLInputElement
Dim htmlColl As MSHTML.IHTMLElementCollection
Set objIE = New SHDocVw.InternetExplorer

With objIE
.Navigate "[link to a form with input box here]"
.Visible = 1
Application.Wait (Now + TimeValue("0:00:05")) 'wait 5 second
Set htmlDoc = .document
Set htmlColl = htmlDoc.getElementsByTagName("input")
Do While htmlDoc.READYSTATE <> "complete": DoEvents: Loop
For Each htmlInput In htmlColl
If Trim(htmlInput.Name) = "lot_text" Then htmlInput.Value = InputString
If Trim(htmlInput.Type) = "submit" Then
htmlInput.Click
Exit For
End If
Next htmlInput
End With

End Sub

Did you found a solution for

Did you found a solution for that problem? I have the same problem. I made in access2010 a form whit a button, onclick he opened IE, goes to the right website but after that i've got the problem.

Using Vb6 project under Win 7

I installed without any problem a system that works ok with Win 7 in 6 o 7 PC's, but in the last machine I tried but received an error when the ODBC connection at the beginning of the execution of my exe.

I suspect the problem is a security matter, but I don't know what to do or if something new in seven that not allowed this Vb6 project to work.

Create a Credential and help the ODBC connection to work, but when I run the EXE I obtain the MSG "Server not found or user without permissions".

Can anyone help me??

Really thanks. MDT

Win 7 and VB6

I used a fancy progress bar in an application built in XP and now when I try to load it in Win7 I get this message, 'vbalProgBar6.ocx could not be loaded -- Continue Loading Project ?'

I also had a project that lost the code window. All my code - gone, but the form was still there ??????

I beg to differ, VB6 does not work fine under Win7.

I heavily depended on a

I heavily depended on a third-party control (Sheridan Grid) for my grid display. To my disappointment Windows 7 wont register the control. Windows 7 does not support Sheridan Grid (version 2), the control that I'm using. I was then forced to abandon Sheridan Grid and experiment with VB6 native control the MSDBGrid. And since I like many of the unique functionality of Sheridan Grid, I incorporate some of it in MSDBGrid. IT'S NOT EASY TO RECREATE those things I enjoyed with Sheridan Grid with MSDBGrid though, but if you can make some work around you are assured that your code would run seamlessly under Windows 7. So if you are unwilling to give up VB6 (like me), limit your use to the native VB6 controls.

Visual Basic Windows 7

Visual Basic installed fine on Windows 7, however when I try to add project references I get "error Accessing System Registry". Any thoughts on this or advice on how to correct the problem ?

about vb6 under win7

hello;
desable win7 uac (user management) and vb6 work fine

Run As Admin

I should have probably put this in the article, but I suggest you always run VB6 as an Admin - that should solve what you describe here I think.

I am running VB5 and that

I am running VB5 and that didn't work, any other suggestions ?

Sorry Dawn, I don't have any

Sorry Dawn, I don't have any experience with trying Visual Basic 5 only vb6. Maybe others here will be able to report if they are able to get VB5 running. Otherwise I suggest using VMware or Virtual Box to run a Windows XP virtual machine or something similar. Then you should be able to install any of the classic VB versions.