DOCUMENT:Q162076 09-AUG-1999 [foxpro] TITLE :HOWTO: Converting VFP Files from Version 3.0 to 5.0 and Back PRODUCT :Microsoft FoxPro PROD/VER:3.00 3.00b 5.00 OPER/SYS: KEYWORDS:kb3rdparty kbdisplay kbprogramming kbtool kbvfp ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0 ------------------------------------------------------------------------------- SUMMARY ======= Running or modifying Visual FoxPro 3.0 forms, class libraries, database containers, report/label files, programs, or menu files in Visual FoxPro 5.0 causes any program code to be recompiled under Visual FoxPro 5.0. This may render some of these items no longer able to be run or modified under Visual FoxPro 3.0. Attempting to run or modify forms, classes, database containers, or report/label files in Visual FoxPro 3.0 after they have been recompiled under Visual FoxPro 5.0 yields an error similar to the following: Error loading file - Methods - record number . Object file \ was compiled in a previous version of FoxPro. -or- Object file \ was compiled in a previous version of FoxPro. You can take steps to allow the running or modifying of files containing Visual FoxPro 5.0-compiled code under Visual FoxPro 3.0. This article explains the basics of conversion, and the steps you can take to "go back," if desired. MORE INFORMATION ================ Converting with a Project ------------------------- 1. Opening a Visual FoxPro 3.0 project in Visual FoxPro 5.0 invokes the Converter and converts the project. Because the structure of the project file itself is different in Visual FoxPro 5.0, the project file cannot be reopened in Visual FoxPro 3.0 after conversion. It is highly recommended to accept the "Backup files" option to allow the Converter to create backup files for all converted files--the "Backup files" check box in the Converter dialog box is selected by default. Unless you specify a different directory, these backup files, including the project's .pjx and .pjt files, are placed in a subdirectory of the project's home directory called \Old. 2. It is important to note that some default property values have changed from Visual FoxPro 3.0 to Visual FoxPro 5.0. These include the FontBold and FontSize properties of the Label control, for example. These changes were made for compatibility with Windows interface standards. Upon conversion, these properties continue to have default values, but these default values are different under Visual FoxPro 5.0. If you wish to retain the Visual FoxPro 3.0 defaults for these properties, you must do the following: a. Forms or class libraries containing these controls must be converted by converting a project that contains them. b. The "Retain Visual FoxPro 3.0 default property values" check box must be selected in the Converter dialog box. 3. Upon conversion, any Visual FoxPro 3.0 .dbc, .vcx, .scx, .frx, or .lbx files (database containers, class libraries, forms, reports, and labels, respectively) within the project that contains procedure or method code are automatically recompiled. If .dbc files contain no stored procedures, or .vcx, .scx, .frx, or .lbx files contain no method code, recompiling is unnecessary and does not occur. 4. Upon conversion, all .prg and .mpr files (programs and menu programs) are automatically recompiled. Converting Individual Components (.vcx, .scx, .dbc, .frx, or .lbx Files) ------------------------------------------------------------------------ 1. If a Visual FoxPro 3.0 .dbc, .vcx, .scx, .frx, or .lbx file (database container, class library, form, report, or label, respectively) is opened, modified, or run in Visual FoxPro 5.0, the file is automatically recompiled under Visual FoxPro 5.0 if it contains any method or procedure code. No changes other than recompiling should occur. If a .dbc file contains no stored procedures, or if .vcx, .scx, .frx, or .lbx files contain no method code, recompiling is unnecessary and does not occur. The .dbc file is an exception under one specific circumstance: If the .dbc is first opened shared under Visual FoxPro 3.0, the compiled stored procedure code within the .dbc will not be overwritten if subsequently opened shared from Visual FoxPro 5.0. In this case, the stored procedures are compile and stored locally in a temp file on the 5.0 machine. Note that opening a .dbc shared within Visual FoxPro 5.0 that has not been opened in Visual FoxPro 3.0 will still result in a recompile. 2. Menus need no conversion; the .mpx file is re-created transparently when the .mpr file is run. Program (.prg) files also behave like this--they are transparently recompiled and an .fxp file created for the appropriate Visual FoxPro version. If the .mpr or .prg does not exist, and the .mpx or .fxp is run, the following error occurs: Object file was compiled in a previous version of FoxPro For more information about the Converter, view the Visual FoxPro 5.0 Help File's Converter Help topic. 3. Individual files may be explicitly recompiled under Visual FoxPro 5.0 (without opening, modifying, or running) by executing the following commands from within a program file or from the Command window: Programs: COMPILE <.prg or .mpr filename> Database containers: COMPILE DATABASE Forms: COMPILE FORM
Class Libraries (this command is new to Visual FoxPro 5.0): COMPILE CLASSLIB Reports or labels (these commands are new to Visual FoxPro 5.0): COMPILE REPORT COMPILE LABEL