Migrating from Visual FoxPro
Visual FoxPro (VFP) is a Windows programming tool made by Microsoft. It has been given its end-of-life and is no longer supported by Microsoft. VFP has its own tightly integrated database engine, a form designer and a programming language.
Migrating
Migrating a Visual FoxPro application is typically a three-step process where you migrate the database itself, the forms that are used to manipulate the data and the scripting code.
Database
When migrating a VFP application, you first need to consider the database. You can connect to a VFP database using ODBC on Windows, but it makes more sense to migrate your data to SQLite, which is a fast, cross-platform database.
Forms
Your VFP forms are likely used to edit data in tables. You can recreate these forms as Windows (or web pages) using drag and drop just as you can with VFP.
For simple desktop applications, you may find the DataControl control to be an easy way to map your fields to database tables and columns without having to write a lot of code.
Source code
VFP is programmed using a proprietary language that is quite similar to the Xojo programming language. You will have to rewrite your code, but at the same time will find the Xojo programming language to be familiar.
Cully Technologies has a tool that can help you migrate your Visual Fox Pro projects to Xojo.
Language syntax
The syntax of the two languages is different, but the concepts are quite similar. For example, to create an instance of a new class in VFP, you might use this code:
LOCAL oMyClass
oMyClass = CREATEOBJECT("MyClass")
In Xojo you would write:
Var oMyClass As New MyClass
The VFP MessageBox command is similar. Instead of writing this:
MessageBox("Hello, World!")
You would write this:
MessageBox("Hello, World!")
Here are some other VFP commands and their Xojo equivalents:
VFP Command |
Xojo Command |
---|---|
ON ERROR |
|
TRY..CATCH..END TRY |
|
DO WHILE..ENDDO |
|
FOR EACH..ENDFOR |
|
FOR..ENDFOR |
|
IF..ENDIF |
|
LOOP |
|
DECLARE |
|
DO CASE..END CASE |
Special thanks to Kevin Cully of Cully Technologies for assistance with the information in this section.
Learn more
To learn more about Xojo and how you can use it to replace Microsoft Visual FoxPro, check out these topics: