Community discussion forum
New code overwriting old versions (in VB5)
-
Hi
I need a hand with a problem in VB5. I have various versions of a program and have old versions and new versions in separate folders. I develop my newer version and then decide to run an older version of the program. I close down VB and open and run my older version of the program but my new code has made it into my old version which was saved in a separate folder! This is a major problem for me.
Is there a piece of memory I clear to cleanly run an old version with out getting new code in there? Is it something to do with the extra files VB creates eg .vbw or .frx
Any advice would be greatly appreciated.
-
VBw (VBp?) files hold the full path to some of the files that make up your program.
If you copy MyFolder, and call the new folder MyNewFolder, the project files insode MyNewFolder still contain references to files in MyFolder.
So if you open the project inside of MyNewFolder, and make a change, the file you change is the one in MyFolder. (The good news is that the file of the same name in MyNewFolder is probably sitting untouched, if you really need the old version back again...)
You could:
Amend the project files to make the file paths 'local' or
Zip up the folder before you start (always a good plan before making changes that might ruin the app!) and/or
If you have Visual Studio, use SourceSafe to store labelled versions of your code as it develops over time.
This is the best solution of all, since you can 'roll back' to a version that you know worked, should things go wrong. It even shows you what lines of code you changed between two versions, allowing you to easily spot what innocent line of code you changed that caused 'version 2' to eat the customer's hard drive...

-
Thanks for your advice - very helpful, I like the idea of SourceSafe but need to go and read up about it. I'm guessing it won't work with VB5 and I will need to upgrade to .net (skipping over VB6 as it's already pretty much run out of time) to get Visual Studio to use SourceSafe.
If I unzip a previously zipped archived project with all associated files I don't expect the new code to be appearing in my archived version - that's what is surprising me here. The workspace file (vbw) should surely be linked to all the archived files and not know anything about the new programs that have been developed since it was zipped. Any ideas? I'm off to read up about .vbw files.......
-
Sourcesafe works fine with VB5. It gets integrated if installed as part of Studio, but there is nothing to stop you using it as a stand-alone tool.
This is not the forum for a Sourcesafe tutorial, but it is worth your while checking out.
(Thats a sourcesafe pun, by the way...wait and see)
As for the files, maybe a bit extra explaination:
Imagine you create a project in folder C:\A
The project includes file frmMain.frm, and the project file holds a list of files: one of them is C:\A\frmMain.frm
Now copy the whole folder to C:\B
Open the project and what it displays is the form C:\A\frmMain.frm,
NOT the frmMain.frm that is in C:\B
So if you make a change and save it, you are amending the original project, not the one in C:\B
Worse, if you are not careful when you add new files and hit save, although you know yyour project folder is C:\A, you may actually have some files sitting in
C:\Program Files\Visual Studio\VB98\
and these won't get added to your zip file...
-
Developments..................
I have a folder called New and a folder called Old. Both contain various forms and modules. There is a module in each folder called mainmodule.bas
When I run the project in the New folder it works a treat. When I close VB down and OPEN the project in the Old folder it is bringing up the code for mainmodule.bas that was used in the previous program eg from the New folder.
VB must have the last run code in cache memory somewhere and is bringing out the wrong version. I understand that it could get mixed up because the names of the modules are the same. How do I get VB to completely forget the last project and stop retaining the code from before. I tried uninstalling VB 5 and re-installing it but Windows seems to have remembered this data albeit it has the wrong program but it has the same name. How do I remove the history of recently run programs.
Any ideas?
-
Please re-read both postings of jefftullin !
Visual Basic does not recognize different folders as different projects !
An example:
1. You create a simple program with a form. The project, code and form are saved in c:\one.
2. You copy all files from c:\one to a folder named c:\two.
3. You open the project in folder c:\two.
Question to you: What project files are you now working with ?
-
Thanks Zorro_ot and jefftullin for your information.
I find it incredibly hard to believe that it does not recognise different projects in different folders. I am using VB 5 and would like to know if this is just a VB 5 thing or whether VB 6 recognises folders as different projects or indeed .net will?
Does this mean the concept of opening an archive program is gone!
Writing modular code stored in libraries can't work then if you save things with the same name but in different folders?
Wish I had known this 3 years ago, is it a flaw in VB and is it fixed in latter versions?
Thanks
-
Here is the first few lines of a VBP file. (I'm on VB6)
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\WINDOWS\system32\stdole2.tlb#OLE Automation
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; comdlg32.ocx
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Form=struct_form.frm
Class=StructureItem; StructureItem.cls
Class=Strc_coll; Strc_coll.cls
Module=Module1; openfile.bas
Form=frmFails.frm
IconForm="Form1"
Startup="Form1"
...What does yours look like?
What do you think will happen if
Class=StructureItem; StructureItem.cls
actually reads
Class=StructureItem; C:\SomeOtherFolder\StructureItem.cls
..without the path, files are local to the VBP file.
If a path exists, it has the source file hard coded, even if you move or copy the VBP.
-
"I find it incredibly hard to believe that it does not recognise different projects in different folders. I am using VB 5 and would like to know if this is just a VB 5 thing or whether VB 6 recognises folders as different projects or indeed .net will ?"
Folders mean nothing to VB6 or VB.Net. This allows you to distribute one project among many folders or to store several different projects in one folder.
"Does this mean the concept of opening an archive program is gone!"
No. You just need to know how to do it RIGHT. When you zip the contents of one project and mess up this project you can unzip the archive. When you overwrite the existing files you will get back the project's state at the time when the zipping was done.
"Writing modular code stored in libraries can't work then if you save things with the same name but in different folders?"
"Wish I had known this 3 years ago, is it a flaw in VB and is it fixed in latter versions?"
You still have not understood the concept how VB5, VB6 and VB.Net are storing project data. They are not supporting different versions of programs in the way you want them to do this. Microsoft never advertised that these products have a versioning system so why do you expect one then ?
Just an example: You buy a car. Later on you would like your car to have a second steering wheel. Is this a bug of the car or is it your's fault not choosing the right type of product ? At the moment you are clearly saying it's a bug of the car.
When you want VB5, VB6 or VB.Net to support different versions of a program you have to do this manually by using different projects. Using a single project but different files or folders does NOT work !
- Set up project 1, insert all gui elements that you need, set their properties, insert your code. Save the project.
- Set up project 2, insert all gui elements, set their properties, insert your code (using copy and paste from the code window !). Save the project.
- Now you have two projects with exactly the same code. When you work on project 1 and change anything it is saved to project 1. When you work on project 2, any changes will be kept in project 2 and will not in any way interfere with project one. If you need more than two versions, just set up as many new projects as you need.
If you want to avoid this procedure either use source safe or use any other CVS system ! Or, if you have the skills, hack the vbp files like Jeff has showed you.

Post a reply
Related discussion
-
How can i develop opc server using .net?
by vairajaig (1 replies)
-
.NET Development Platform
by Wizdata (0 replies)
-
Are you still using VB6?
by shahid123 (2 replies)
-
Are you still using VB6?
by Wizdata (0 replies)
-
Check to see if Application is still running
by flower123 (6 replies)
Quick links
Recent activity
- nancy smith replied to 20+ Free DVD Menu Templates...
- with window replied to Hot News: Convert any video...
- Tom Hank replied to How to convert/transfer tha...
- beauty girl replied to How to convert/transfer tha...
- beauty girl replied to How to convert/transfer tha...
- alex nikle replied to Free convert mpeg to wmv wi...
Enter your message below
Sign in or Join us (it's free).