6

A small ma and pa shop came to me recently with a request to update a vb6 program one of their former part time employees made for them while home from college. On the cd the student provided is both the source code and a installer for the program, which extremely helps. I would like to just give them a new cd with a new installer and the updated source code. My question is, how do I go about creating or if easier updating a installer for a language that entered "Non Supported Stage" back in 2008?

Update: Just to answer some of the questions, the updates they are asking for are just changing the wording of some labels and changing one control from a textbox to a combobox. They are a ma and pa shop and don't want to pay the cost to have the app re-written to a newer language, even though it has been recommended.

Scott
  • 11,046
  • 10
  • 51
  • 83
  • 4
    What exactly is the business case for "updating"? Are you just trying to make some modifications to the software in VB 6? Or is there a reason you need to migrate the application to an entirely new language? Guaranteed ma and pa aren't going to know the difference between VB.NET and VB 6, as long as the app does what they want. The last sentence of your question leads me to believe all you want to do is generate a new installer? Can you elaborate on that? – Cody Gray - on strike Jan 12 '11 at 01:24
  • 2
    **RE: latest edits:** The other Scott's answer is exactly what you're looking for. Whether by accident or not, Ma and Pa are exactly right that it makes little sense to rewrite the app in a newer language. It does what they want, and Windows will continue to support VB 6 applications for the foreseeable future. Those changes aren't very major, and you should be able to implement them easily once you get a copy of VB 6. Most of your time will be spent compatibility testing with newer versions of Windows and learning Inno Setup. Post any questions you have along the way; we're happy to help. – Cody Gray - on strike Jan 12 '11 at 04:10

3 Answers3

7

You're going to need a copy of Visual Basic 6 (or Visual Studio 6) which is difficult. If you have an MSDN subscription, I'm quite sure you can download it from their archive, but if not, you might need to buy a copy. Check EBay. Have the ma and pa shop purchase it at their own expense, and they should own it in case they want to make future changes. You can use it on their behalf to do work for them, if you're the only one using it, and just uninstall it when you're done.

Also, if you have a copy of Visual Studio 2005, technically you can "downgrade" to VS6 but you have to call Microsoft and have them send you the install program, and you're not allowed to use VS2005 concurrently with VS6. Yeah, I know...

Ok, so if you've got that far, get the source on your computer and get it under source control. I suggest Mercurial (specifically the TortoiseHg client). I've had lots of luck with it on a VB6 project, and it's free. (Don't use SourceSafe, even if it comes free with VS6!) The distributed nature of the Mercurial repository means you can hand them back a CD with the entire repository on it, and the next poor sap who has to make changes will at least be able to do a diff and know what you did.

As someone else here said, VB6 has a built-in utility for making install programs, but I think you had to have the Enterprise version for that. It's worth finding that out before you get a copy.

Now go ahead and make changes, but be very careful. Remember that you probably don't have any unit tests, so you're likely to break stuff. If you want to be professional about it, there are unit testing frameworks out there for VB6. For instance, vbUnit. Again, I suggest having the customer buy a copy (about $99 for a single developer seat, I think). If the change was anything more than changing the company logo on the splash screen, then this is something I'd invest in. Write tests that cover every module or feature you're going to change. If all the logic is in event handlers in the form itself, carefully remove the code you need to change out into modules that you can write unit tests for. Write the tests to verify the current functionality first.

Then go ahead and make your changes. If you've gone to the trouble of setting up a testing framework, then you might as well use some TDD and write your tests first. Write a test, make sure it fails, write enough code to make it pass, and repeat.

All of this still requires you to have a solid manual test plan to check the functionality at the end. That means you need a solid grasp of what it does. You can pretty much assume that no matter how careful you are, you'll break something you didn't understand. Make sure to give yourself enough time to fix other problems that pop up after you deliver it.

I recommend against re-writing it in .NET unless it's a really simple program with only one form. The effort likely isn't worth it.

Caveat: beware of 3rd party components the original programmer might have used, but not included on the CD. If they used some ActiveX or COM stuff that they purchased from a 3rd party, but they didn't license it to your customer, you might have to end up purchasing it again just to get it to compile.

EDIT:

Based on your extra information, if you're really just changing a couple of controls and wording, then I think you can get away without a unit testing framework. I would definitely use some source control though.

I do remember using the Package and Deployment Wizard, and I agree it sucked. I actually used a 3rd party installer, now that I think about it. However, if the changes are small and the original application used the PDW, I'd probably stick with that.

Scott Whitlock
  • 13,739
  • 7
  • 65
  • 114
  • 3
    +1 This is a good answer. The advice given is solid and well worth considering. A couple of things to add: The VB 6 "Package and Deployment Wizard" is indeed provided in the Professional Edition of the suite, but I *highly* recommend ditching this in favor of Inno Setup, especially if you're going to be installing in Windows Vista/7. The UI is so much cleaner, the setup program is so much more powerful, and it's not that much more difficult to use. Also, consider an MSDN subscription. You'll get access to VB 6 as well as the newer development environments and other important tools. – Cody Gray - on strike Jan 12 '11 at 04:06
  • Finally (ran out of space), in addition to the 3rd party components the original programmer might have used but not included, you also have to watch out for controls that are unsupported in later operating systems (like Vista/7). Most of these can be replaced by built-in controls, but not all. It may be worth it to (re)-write certain controls/components in VB.NET (or C#, if you prefer) and use them as COM components from the VB 6 application. This is a good way to retrofit an old app with new functionality without rewriting the whole thing. Another way an MSDN subscription comes in handy. – Cody Gray - on strike Jan 12 '11 at 04:08
  • 1
    +1 Really excellent advice. @Cody Inno Setup has a good reputation, the VB6 PDW certainly doesn't! Just for completeness there are other options for VB6 deployment are discussed in [this question](http://stackoverflow.com/questions/23836/what-is-the-best-simple-install-system-for-xp-vista). – MarkJ Jan 12 '11 at 09:09
  • @MarkJ: Just for clarity, I was indeed recommending the use of Inno Setup instead of the VB PDW. I just realized that my phrasing ("ditching this in favor of [that]") may not have been very clear. – Cody Gray - on strike Jan 12 '11 at 09:11
  • @Cody, I thought your comment was clear and helpful (as usual) and I upvoted it. Just wanted to add a link to a question with some good further discussion of installers – MarkJ Jan 12 '11 at 09:19
  • If the old installer works then there should be no need to change it if all you are doing is recompiling a new exe with some minor changes. If you need a new installer for some reason not explained by the OP then Inno is the way to go. – Cidtek Jan 12 '11 at 17:06
  • "you're not allowed to use VS2005 concurrently with VS6" -- really? Where does it say that, please? – onedaywhen Jan 14 '11 at 10:11
  • @onedaywhen - see [here](http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/fdc67d40-f434-49b6-b626-a9c50bf23429/) – Scott Whitlock Jan 14 '11 at 13:33
  • @onedaywhen - and [here](http://www.vbmonster.com/Uwe/Forum.aspx/vb/9228/Downgrading-Visual-Basic-NET) – Scott Whitlock Jan 14 '11 at 13:36
  • @Scott Whitlock: thanks. I think what you are saying is that "you're not allowed to use VS2005 concurrently with VS6 if you have downgraded from VS2005 to VS6." Correct? I mean, if I have purchased VB6 (many years ago now) and subsequently purchased VS2005, there is no problem installing both and running them concurrently, right? Wording from one of your links says, ""If you have access to existing LICENSED software you may use it". – onedaywhen Jan 14 '11 at 14:27
  • @onedaywhen - yes, that's correct. The "licensed" software just means they don't want you installing a cracked copy. – Scott Whitlock Jan 14 '11 at 23:58
0

You Can Convert VB6 projects to .NET.

If you have Visual Studio 2005 or higher... Or the worse case is re write the code using VB.NET. Go to this Link.

Convert VB6 - .NET

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Crimsonland
  • 2,194
  • 3
  • 24
  • 42
  • It should be noted that the converter doesn't support all the features of VB6, so depending upon how "clever" this employee was, you might end up having to rewrite portions of the app (or the entire app). – Amanda Mitchell Jan 12 '11 at 00:43
  • 4
    Not only does it "not support all the features of VB 6", the automated converters are basically a joke. Regardless of how "clever" the original programmer was, you'll end up rewriting so much code that you might as well not have started with the baggage in the first place. There are much better strategies, if we can figure out what Scott's/Scott's client's motivation is here. – Cody Gray - on strike Jan 12 '11 at 01:25
  • I've usually found it far easier to start from scratch. The converter has to holdover a lot of stuff that messes up your code and doesn't follow newer conventions. Using the existing code as a template, you can quickly rewrite it (usually). – Brad Jan 12 '11 at 01:26
  • I suggest **these** [two](http://msdn.microsoft.com/en-gb/dd408373.aspx) [links](http://stackoverflow.com/questions/tagged/vb6-migration?sort=votes&pagesize=50) instead. – MarkJ Jan 14 '11 at 12:27
0

If I recall correctly, Visual Studio 6 came with a rudimentary wizard for creating an installation program for a VB6 application. So, assuming that you have Visual Studio 6 installed for VB6, there should be an installer wizard that you can use. However, it may have problems deploying the VB6 runtimes on Vista or Win 7 machines. Perhaps another SO guru will have the answer to that one.

You can also use the freeware Inno Setup to create an installer for a VB6 application. More information can be found here. However, it requires more manual effort than what came with Visual Studio.

Bob Mc
  • 1,980
  • 1
  • 28
  • 38