Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting VB3 to VB5 format

Status
Not open for further replies.

WyoProgrammer

Technical User
May 13, 2005
25
US
Is there a program out there that will convert a program written in VB3 to VB5. I am a novice programmer but have written an extensive program in VB3 which I use at work. We have converted to a server which is operating under MS Server 2003 and it is not handling the 16 bit program at all well. I have VB5 as well and would like have it run as a 32 bit program. Any suggestions short of hand coding the entire thing? I know that I can save all my forms as text and open them in the VB5 environment, which I have tried but the controls are messed up. Help!
 
Many of hte older VB programs / contgrols can simply be replaced with their 'newer' equivalents. Often the difference is some minor nomenclature change. Simce all VB objects are actually stored as text file (at least until complie time). you canb write a parseing program to open each object in the older program, examine it for a set / list of items to modify, and change as desired. There are two obvious issues which need to be addressed.

First, the header of the text file will include the "version" number. This is (as i dimly recall) in one and only one place, hte very top of the text (source code) file For VB 5 (& 6!!) it says VB 5.00 (or something very much like that). Examine any VB5 source code (text) module with any editor to get the exact line. It needs to be replaced in EVERY source object Text file.

Next is to find each item (control, procedure, declaration, ... ) which causes a problem. Figure out the replacement. Write a procedure to open each (source) object, scan each line for items to modufy/replace and "fix" it.

A few thoughts (from the trenches). It WILL NOT be a perfect soloution on te first itteration, so always save the outputs to a NEW folder.

After each attempt, review the source code (text) generated IN A TEXT editor, checking the intended modification / replacements. It they are not completly correct, fix your parseiing program and rerun it, overwitting the (previous) output is - - - in this situation - - - is generally ok.

When you get a source code file which 'passes' the editor / eyeball check, try to open the project file (build a new on for the initial attempt). If the project will opentry the run with full compile option.

Examine each compile error, noting what you change to pass this carefully. These items need to be added to the list of items to modify / replace in the parse profgram.

When the parse program generates a set of source code modules which generate an error free compile, you have reached a major milestone.

Make a couple of archive / backup copies of this set of source files.

Start the process all over, using the error free compile source as the starting point, but you would now be looking for execution errors, so a thorough test is necessary. You WILL be tempted to make changes here directly in the VB Editor, and not generate a new list of items to programatically modify / replace. I strongly advise aginst this. It is WAY to easy to do something badly and have to back up to whereever. Having written the basic parseing program, it might as well be used as much as possible. I also advise aginst making cosmetic changes to form and / or reports at this point, as the look and feel issues are reasonably done in the IDE after the program actually does work in the new environment.

Finally, the parse program should NOT have the various search and replace items hard coded into the program. If you are comfortable with db use, a simple table (Ms. A, "Jet" table ~~ db can be set up to have the necessary find this replace with that structure. The structure can then be modified as your needs and undestanding evolve, without changes to the code. This also facillitates making different changes at different stages of the process, so you might find a group of items which you want to change - without running through other steps, and -using hte external soource - you can just set up another table to do teh specific items or (alternatively) include a boolean field (or several?) to designate the items to do the search on.

For LARGE programs, this can be a highly effective approach. For small projects, it might seem like more effort than just re-designing (and coding and testing and ...). On the other hand, once the overall technique is understood and hte basic parseing program developed, you have a tool which may be useful in the future.




MichaelRed


 
>Simce all VB objects are actually stored as text file

Not always true with VB3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top