Migrating from Visual FoxPro

From Xojo Documentation

Revision as of 22:03, 21 March 2021 by Gperlman (talk | contribs) (Language Syntax)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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


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.


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 Exception
DO WHILE..ENDDO While...Wend


FOR EACH..ENDFOR For Each...Next
FOR..ENDFOR For...Next
IF..ENDIF If...Then...Else
LOOP Continue

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: