Results 1 to 38 of 38

Thread: [RESOLVED] Help transitioning from VB2 to VB6

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    Resolved [RESOLVED] Help transitioning from VB2 to VB6

    Hello, hello, hello!

    I'm starting a project in VB to translate info from 7 track tape and convert it to tables for import into an Access 2000 DB.

    Here is my first problem...

    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.

    Anybody have any suggestions on a good way to do this
    Last edited by KidJavelin; Oct 4th, 2005 at 01:40 PM. Reason: Wrong title

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Help transitioning from VB2 to VB6

    Quote 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.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  4. #4
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: Help transitioning from VB2 to VB6

    Nope. That's the one.

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Help transitioning from VB2 to VB6

    Quote 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.

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    Re: Help transitioning from VB2 to VB6

    In its entirety -
    VB Code:
    1. Private Sub OpenFile_Click()
    2.     Dim Confirm As Integer
    3.     Dim cnt As Integer
    4.     ' ****************************************
    5.     last_rcd = 0
    6.     cnt = 0
    7.     Confirm = True
    8.     '***************************
    9.     Form1.LCSFButton.Visible = False
    10.     Form1.NewRcd.Visible = False
    11.     Form1.OpenFile.Visible = False
    12.     ' ********************************
    13.     ' Get File Name
    14.     ' ********************************
    15.     ' Set filters
    16.     With CommonDialog1
    17.       .Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt"
    18.       ' Specify default filter
    19.       .FilterIndex = 2
    20.       ' display the File Open dialog
    21.       .ShowOpen
    22.       ' return selected file name
    23.       Filename = .Filename
    24.     End With
    25.     ' ********************************
    26.     If Filename = "" Then
    27.         Form1.NewRcd.Visible = True
    28.         Form1.OpenFile.Visible = True
    29.         Exit Sub
    30.     Else
    31.         Filenum = FileOpener(Filename, READFILE, 82, Confirm)
    32.         Form4.Caption = Filename
    33.         Form8.Label7.Caption = Filename
    34.         totrcds% = (LOF(Filenum) / 82)
    35.         Form8.Label8.Caption = Str(totrcds%)
    36.         Form8.ProgressBar1.Value = 0
    37.         Form1.CloseFile.Visible = True
    38.         oflag% = 1
    39.         Initialize
    40.         SetShow
    41.     End If
    42. End Sub

    John


    Edit: Added [vbcode][/vbcode] tags for clarity. - Hack

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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.

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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).

  10. #10

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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?

  11. #11
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Help transitioning from VB2 to VB6

    Quote 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?

  12. #12
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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.

  13. #13

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  14. #14
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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).

  15. #15

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  16. #16
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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.

  17. #17
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    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?

  18. #18

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  19. #19
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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.

  20. #20

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  21. #21
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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?

  22. #22

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  23. #23

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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.

  24. #24
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Help transitioning from VB2 to VB6

    Quote 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.
    Quote 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.

  25. #25

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  26. #26
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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.

  27. #27

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  28. #28

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  29. #29
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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?

  30. #30

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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

  31. #31

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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.

  32. #32
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Help transitioning from VB2 to VB6

    Try finding the Form2T.frx file.

  33. #33
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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.

  34. #34

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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...

  35. #35
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Help transitioning from VB2 to VB6

    Again, images stored in the Toolbar is in the *.frx files.

  36. #36
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: Help transitioning from VB2 to VB6

    Quote 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.

    Quote 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.

  37. #37
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Help transitioning from VB2 to VB6

    Quote 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.

  38. #38

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    Poulsbo, WA
    Posts
    60

    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
  •  



Click Here to Expand Forum to Full Width