|
-
Oct 4th, 2005, 01:38 PM
#1
Thread Starter
Member
-
Oct 4th, 2005, 01:46 PM
#2
Re: Help transitioning from VB2 to VB6
 Originally Posted by KidJavelin
I have to migrate the VB application from version 2.0, to version 6.0  . From what I've been able to gleen so far, it's REALLY hard to do.
I didn't even know there was a VB 2.0
The answer to your question is No. There is not a good way, just a way.
I started with VB3 so I'm assuming prior versions had the same "feature" of saving forms. In those releases the forms were saved as binary. Forms are now saved as text (I think that started with VB4, but I may be wrong there).
I'm not sure VB6 even knows how to read a binary form. This is something you would have to try and see what happens.
You would need to start a new VB6 standard Exe project, remove the default Form1, and then load each of the forms and modules from the old project to the new project file.
Providing you can get the forms and modules to be accepted by a VB6 project, you may face the possibility of controls that we used in this project that are not supported by VB6. Third party controls at that time were .VBX files, not .OCX files. Hopefully you will be able to find a replacement for any control VB6 doesn't like from VB6 itself. If the project uses third party, purchased .VBX controls, you may be out of luck.
The code itself should not present to many obstacles, but then, I haven't seen it, so I really can't say for sure.
-
Oct 4th, 2005, 01:58 PM
#3
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Wow, fast response!
Okay, I did that(its a small app thankfully). Now when I try to bring in a text file to view/edit I kacks out on a file filtering routine -
.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt"
' Specify default filter
.FilterIndex = 2
' display the File Open dialog
.ShowOpen
' return selected file name
Filename = .Filename
Even with my VERY limited exposure, I can see this is an outdated method of file filtering. Is there a more modern approach?
John
-
Oct 4th, 2005, 02:00 PM
#4
Re: Help transitioning from VB2 to VB6
-
Oct 4th, 2005, 02:02 PM
#5
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Why does it freak then I wonder? Does it require some sort of runtime library? I think I should point out this is coding behind a button on the form. Does that make any difference?
John
-
Oct 4th, 2005, 02:12 PM
#6
Re: Help transitioning from VB2 to VB6
 Originally Posted by KidJavelin
Why does it freak then I wonder? Does it require some sort of runtime library? I think I should point out this is coding behind a button on the form. Does that make any difference?
John
Nope. No difference at all. Post the entire routine.
-
Oct 4th, 2005, 02:14 PM
#7
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
In its entirety -
VB Code:
Private Sub OpenFile_Click()
Dim Confirm As Integer
Dim cnt As Integer
' ****************************************
last_rcd = 0
cnt = 0
Confirm = True
'***************************
Form1.LCSFButton.Visible = False
Form1.NewRcd.Visible = False
Form1.OpenFile.Visible = False
' ********************************
' Get File Name
' ********************************
' Set filters
With CommonDialog1
.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt"
' Specify default filter
.FilterIndex = 2
' display the File Open dialog
.ShowOpen
' return selected file name
Filename = .Filename
End With
' ********************************
If Filename = "" Then
Form1.NewRcd.Visible = True
Form1.OpenFile.Visible = True
Exit Sub
Else
Filenum = FileOpener(Filename, READFILE, 82, Confirm)
Form4.Caption = Filename
Form8.Label7.Caption = Filename
totrcds% = (LOF(Filenum) / 82)
Form8.Label8.Caption = Str(totrcds%)
Form8.ProgressBar1.Value = 0
Form1.CloseFile.Visible = True
oflag% = 1
Initialize
SetShow
End If
End Sub
John
Edit: Added [vbcode][/vbcode] tags for clarity. - Hack
-
Oct 4th, 2005, 02:19 PM
#8
Re: Help transitioning from VB2 to VB6
The first thing that jumped out at me is that the variable Filename is not declared anywhere. Declare it as a string at the top of the routine and then see what happens.
-
Oct 4th, 2005, 02:19 PM
#9
Re: Help transitioning from VB2 to VB6
That is not VB2 code, neither the With block nor the ShowOpen method was available in VB2. But the error is probably because you haven't added the Microsoft Common Dialog control to your project (and Form).
-
Oct 4th, 2005, 02:25 PM
#10
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
If it's not VB2, what is it? That would explain why I'm having such a bear of a time finding information about it...
There is a CommonDialog1 control on the form. Should this be called CommonDialog only? How does this interact with the rest of the form? Currently it shows up in object properties as a picture box?
-
Oct 4th, 2005, 02:31 PM
#11
Re: Help transitioning from VB2 to VB6
 Originally Posted by KidJavelin
If it's not VB2, what is it? That would explain why I'm having such a bear of a time finding information about it...
There is a CommonDialog1 control on the form. Should this be called CommonDialog only? How does this interact with the rest of the form? Currently it shows up in object properties as a picture box?
Open NotePad and drag one of your forms into it. What does the first line say?
-
Oct 4th, 2005, 02:34 PM
#12
Re: Help transitioning from VB2 to VB6
It must be written in VB4 or later.
The fact that it shows up as a picture box means that it isn't a common dialog control but a picture box . When VB isn't able to load a particular control it will replace that with a picture box. What you have to do is to click Project > Components and check the Microsoft Common Dialog Control. You will now get this control added to your toolbox. Remove the picture box named CommonDialog1 and replace it with one of these (it will be named CommonDialog1 by default, keep that name).
BTW, you don't have to care much about where on the Form you place this control since it is invisible during run-time.
-
Oct 4th, 2005, 02:48 PM
#13
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Okay, All the forms - or the ones I can get to - say VB5.0, but I could've sworn they said VB2 before. Oh well, wouldn't be the first time I've seen things.
I put the CommonDialogControl on the form and now it errors on the "FilterIndex = 2" line. I'm thinking this is an incorrect representation of the default file type.
John
-
Oct 4th, 2005, 02:52 PM
#14
Re: Help transitioning from VB2 to VB6
If this is a VB5 project you should be able to open the *.vbp file in VB6. You might get messages that states something in the line of "a newer version of xxx is available, do you want to update the project" (or something simular, I don't remember the exact message).
-
Oct 4th, 2005, 03:01 PM
#15
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
You guys answer these posts QUICK! Thanks!
I never got anything like that when I pulled the forms in or tried to run it in VB6(actually Visual Studio). The rest of the forms open up without problems via button clicks when I run the application.
I do have two files in the directory, both with .BAS extensions that look like a file opening routine and the file hashing routine. Then there is a .INI file that has specific reference material.
Then there is VBRUN300.DLL.
John
-
Oct 4th, 2005, 03:11 PM
#16
Re: Help transitioning from VB2 to VB6
So you don't have a project file. You add the .BAS files by clicking Project > Add Module (not class module) and browse to the files (on the Existing tab of the dialog box). The INI file is probably read in by the program and normally you wouldn't add this file to the project within the IDE (even though you could).
The VBRUN300.DLL is the VB version 3.0 run-time library (so we have now gone from VB2 via VB5 to VB3 ). However the code you have published above is not VB3 code either, the With ... End With block statements was added to VB in version 4. Also the fact that the Common Dialog control is called CommonDialog1 on the form states that it was designed in a later version since in VB3 the default name of the common dialog object when you added it to a Form was Common1.
-
Oct 4th, 2005, 03:19 PM
#17
Re: Help transitioning from VB2 to VB6
It also looks to me like VB4 as well, however there wrere two version: 16 and 32 bit so each VBX and OCX controls respectively. I would assume that that was written in VB4 16 bit so that's why control (CommonDialog) cannot be a loaded class. Am I missing something?
-
Oct 4th, 2005, 03:20 PM
#18
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Hey man, I didn't write it. How many times have you heard that?
So the thought is now occuring to me that I'm not dealing with the entire picture here, if we're seeing so many parts of this in so many different versions.
Sound accurate to anyone else?
John
-
Oct 4th, 2005, 03:33 PM
#19
Re: Help transitioning from VB2 to VB6
I understand that you didn't write this. It also looks that you haven't access to the whole source code, since there is no *.vbp file (or *.mak file). This project might have been written in VB2 or VB3 and later have been updated to VB5 (if your Form files state that they are written in VB5 then they must be).
The problem with the controls not being loaded could be simply because you haven't loaded a project file but instead added all Form files to a new project. VB can fail to recognoize controls from an earlier version when you do this.
What error do you now have with your source code? I find it very strange that you get an error with the FilterIndex property but if you want you can comment out this line and change the Filter to "Text Files (*.txt)|*.txt|All Files (*.*)|*.*" instead of having "All Files" first.
-
Oct 4th, 2005, 03:41 PM
#20
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Quote *Hey man, I didn't write it. How many times have you heard that?*
That was supposed to be a joke. Sorry if it didn't come across that way. I really appreciate all the assistance.
Okay, back to our story...
I did find a *.MAK file in another directory(?) from the one I pulled all the rest of the files from. Is this file supposed to reside outside the project like a *.DLL or does it live inside the project?
Edit***
I changed the source code line to what you suggested(re order the filters Text files and All files). It now stops on the line ShowOpen for some reason.
***
John
-
Oct 4th, 2005, 03:51 PM
#21
Re: Help transitioning from VB2 to VB6
The *.mak extension was used in VB3 and earlier as the project file. It was changed in VB4 to *.vbp to not collide with make files used in other languages (like C or C++). You will not be able to open a mak file in VB6, but you could open it in Notepad and post the text here so we can see if this really is an old VB project file or not.
So you get an error.... What is the error message you get?
-
Oct 4th, 2005, 03:58 PM
#22
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Error - "Sub or Function not defined"
This is the *.MAK file -
Type=Exe
Form=form1t.frm
Module=FILEPROC; FILEPROC.BAS
Module=SADEP1; SADEP.BAS
Form=FORM2T.FRM
Form=FORM7T.FRM
Form=FORM4T.FRM
Form=FORM3T.FRM
Form=FORM6T.FRM
Form=FORM5T.FRM
Form=form8t.frm
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0; COMDLG32.OCX
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0; COMCTL32.OCX
IconForm="Form1"
Startup="Form1"
HelpFile=""
Title="SADEP1"
ExeName32="Sadep20.exe"
Command32=""
Name="Sadep"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="[Removed by John for posting purposes]"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
ThreadPerObject=0
MaxNumberOfThreads=1
What do I look for the determine the version?
John
-
Oct 4th, 2005, 04:00 PM
#23
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
I see the 32 references, so I would think it's later then VB3. But I don't see where it specifies which version.
-
Oct 4th, 2005, 04:11 PM
#24
Re: Help transitioning from VB2 to VB6
 Originally Posted by KidJavelin
I see the 32 references, so I would think it's later then VB3. But I don't see where it specifies which version.
 Originally Posted by MartinLiss
Open NotePad and drag one of your forms into it. What does the first line say?
It will say "VERSION 5.00" if it's VB5 or 6.
-
Oct 4th, 2005, 04:16 PM
#25
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
The forms say Version 5.0.
I was led to believe it was written originally in VB 2.0. What little documentation that is available supports that as well. No one advised me of any updating that may have happened although it's entirely possible.
John
-
Oct 4th, 2005, 04:37 PM
#26
Re: Help transitioning from VB2 to VB6
That mak file should have the vbp extension since it is a project file for at least VB5. It is not an old *.mak project file. It should also be placed in the same directory as you have the following files:
FORMxT.frm (where x represent the numbers 1-5 and 8).
FILEPROC.BAS
SADEP.BAS
So try to rename this file and put it with the others (if they actually is a part of this project so that this isn't belonging to another project). Then try to open it by simply selecting File > Open in the VB6 IDE.
-
Oct 4th, 2005, 04:46 PM
#27
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
I'll give it a shot when I get in tomorrow and let you all know.
Right now I feel the need to turn the amp up to 11 end rattle my brain into a more conducive thinking state .
Thanks again for all the help!
John
-
Oct 5th, 2005, 09:08 AM
#28
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Well, I tried the *.MAK file renaming. Everything blew up . I'm going to try importing step by step into a new project, since it's a fairly small application.
Cross your fingers, I can tell you mine are...
John
-
Oct 5th, 2005, 09:22 AM
#29
Re: Help transitioning from VB2 to VB6
I don't understand why it blow up for you. I just tried the following. I created 8 Forms and named them Form1T.frm to Form8T.frm, I also created two modules named FILEPROC.BAS and SADEP.BAS and stored these files in a directory. I then copied the MAK file code you posted above, pasted into Notepad and saved it as WhatEver.vbp in the same directory as the other files. I then double clicked this WhatEver.vbp file in Windows Explorer, which launched VB and loaded all the Forms and the two modules + the Windows Common Controls and the Common Dialog Control that the project file also referenced.
So my question is did you copy all the *.frm files and the two modules (*.bas) files to a new directory and then put this *.mak file in the same directory and renamed it *.vbp?
-
Oct 5th, 2005, 09:53 AM
#30
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Sorry about the lag time, juggling projects.
Yes I did. I even renamed the *.MAK file as you did, a different file name and the *.vbp extension. Let me try the process you just outlined above.
John
-
Oct 5th, 2005, 10:02 AM
#31
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Interesting,
Recieved an error for FORM2T -
"Line 79: Property Text in Text1 had an invalid file reference."
The TextBox in question contains this code -
Private Sub Text1_GotFocus()
Text1.SelStart = Len(Text1.Text)
End Sub
Ideas?
Last edited by KidJavelin; Oct 5th, 2005 at 10:07 AM.
-
Oct 5th, 2005, 11:58 AM
#32
Re: Help transitioning from VB2 to VB6
Try finding the Form2T.frx file.
-
Oct 5th, 2005, 12:33 PM
#33
Re: Help transitioning from VB2 to VB6
Maybe I should explain that a little better. The layout and code of a Form is saved as pure text in the *.frm file. But some things can't be saved in that file, for example an image you have assigned during design-time to a PictureBox, since that is binary data. So that information is instead saved in a *.frx file.
The Text you assign to a TextBox at design-time is normally saved in the *.frm file, unless the MultiLine property is set to True, in which case the text is stored in the *.frx file since it could now be a lot of text.
This would only be a problem if the Text box had any text set during design time (besides maybe the default "Text1" text). If this TextBox doesn't have any default text you can simply ignore this error and resave the file.
-
Oct 5th, 2005, 12:42 PM
#34
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Hooray!
I got it to open without any errors! It will even open the text files it's supposed to look at! Thank you!
Just need to figure out how to put the standard toolbar back in now...
-
Oct 5th, 2005, 12:51 PM
#35
Re: Help transitioning from VB2 to VB6
Again, images stored in the Toolbar is in the *.frx files.
-
Oct 5th, 2005, 06:02 PM
#36
Re: Help transitioning from VB2 to VB6
 Originally Posted by Hack
I didn't even know there was a VB 2.0 
There were 2 versions of VB1, a DOS version which was the first which didn't catch on and a Windows version.
 Originally Posted by Hack
I'm not sure VB6 even knows how to read a binary form.
As already mentioned VB2/3 saved their files in Binary format but you can change this to Text in the options. VB6 won't open a Binary file.
.ShowOpen didn't appear until VB4, in VB2/3 you had to use .Action = 1
I still use VB3, VB4 16bit and VB6. The original code may have been VB2 but its been converted over the years but this code is VB4 32bit.
If your still having problems converting it then post the project here, because you can't PM me with it.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Oct 5th, 2005, 06:09 PM
#37
Re: Help transitioning from VB2 to VB6
 Originally Posted by Keithuk
The original code may have been VB2 but its been converted over the years but this code is VB4 32bit.
Nope, it's a VB5 project file, and I think he got it resolved.
BTW, the Windows version of VB1 was released before the DOS version.
-
Oct 6th, 2005, 10:47 AM
#38
Thread Starter
Member
Re: Help transitioning from VB2 to VB6
Yes it appears to be working at the moment, thank you everyone that helped. They were even able to do some simple data manipulation with it yesterday.
I really wouldn't be surprised if it was updated several times in the past without a documentation update. They work like that here...
John
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|