# 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 <span class="title-ref">database</span> engine, a form designer and a programming language.

## Migrating

Migrating a Visual FoxPro application is typically a three-step process where you migrate the <span class="title-ref">database</span> itself, the forms that are used to manipulate the data and the scripting code.

### <span class="title-ref">Database</span>

When migrating a VFP application, you first need to consider the <span class="title-ref">database</span>. You can connect to a VFP <span class="title-ref">database</span> using ODBC on Windows, but it makes more sense to migrate your data to SQLite, which is a fast, cross-platform <span class="title-ref">database</span>.

### 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 <span class="title-ref">database</span> 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](http://cully.biz/2012/03/05/visual-foxpro-to-real-studio-converter-0-1beta/).

## 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:

``` xojo
LOCAL oMyClass
oMyClass = CREATEOBJECT("MyClass")
```

In Xojo you would write:

``` xojo
Var oMyClass As New MyClass
```

The VFP MessageBox command is similar. Instead of writing this:

``` xojo
MessageBox("Hello, World!")
```

You would write this:

``` xojo
MessageBox("Hello, World!")
```

Here are some other VFP commands and their Xojo equivalents:

| VFP Command         | Xojo Command                                                                                |
|---------------------|---------------------------------------------------------------------------------------------|
| ON ERROR            | `Exception</api/exceptions/exception>`                                                      |
| TRY..CATCH..END TRY | `Try...Catch</api/language/try>`                                                            |
| DO WHILE..ENDDO     | `While...Wend</api/language/loops/while...wend>` `Do...Loop</api/language/loops/do...loop>` |
| FOR EACH..ENDFOR    | `For Each...Next</api/language/loops/for_each...next>`                                      |
| FOR..ENDFOR         | `For...Next</api/language/loops/for...next>`                                                |
| IF..ENDIF           | `If...Then...Else</api/language/if...then...else>`                                          |
| LOOP                | `Continue</api/language/loops/continue>`                                                    |
| DECLARE             | `Var</api/language/var>`                                                                    |
| DO CASE..END CASE   | `Select Case</api/language/select_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:

- [Xojo Q&A for FoxPro Developers](https://youtu.be/p6pTX6gC_mc)
- [FoxCon 2015: Xojo for Desktop and Web](http://cully.biz/2015/02/08/foxcon-2015-my-presentation-on-xojo-for-the-desktop-and-web/)
- `Getting Started</getting_started/introduction/welcome>`
- `Desktop App Tutorial</getting_started/tutorials/desktop_tutorial>`
- [Web App Tutorial](http://www.xojo.com/docs/tutorial/web/)
- `iOS App Tutorial</getting_started/tutorials/ios_tutorial>`
- `Using SQLite</topics/databases/supported_engines/sqlite/using_sqlite>`
