Useful FoxPro commands


Visual FoxPro is a large and mature language with a wide choice of commands and functions. Many were introduced in earlier versions of the language and have been carried through from FoxBase to VFP.

This means that it can sometimes be difficult to find just what you want in the Help system when you are starting to learn the language. This is a list of some of the more useful commands and functions.

The distinction between commands and functions is that commands do something whereas functions just return a value to be displayed or used in another command.

General commands

CLEAR Clears the screen
CLEAR MEMORY Clears variables from memory
CLOSE DATA ALL Closes all tables and databases
QUIT Closes FoxPro

Files and directories

CD <dir> make <dir> the current directory.
CD ? display a directory tree and switch to the directory chosen.
GETDIR() display a directory tree and returns the directory name as a string.
GETFILE() displays a file-selection dialog and returns the file name as a string.
GETPICT() displays a file-selection dialog showing image files and returns the file name as a string.

Miscellaneous

EMPTY() return .T. if field or variable <name> is empty.
GETCOLOR() display a colour picker and return the code for the colour chosen.
ISNULL() return .T. if field or variable <name> is a null.
TYPE() return a code showing whether <name> is numeric, text, etc.

Hints & tips

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map