Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

_Samples

This system variable, added in VFP 6, contains the path to the sample code that comes with Visual FoxPro.

Usage

_SAMPLES = cPathToSamples

In VFP 6, MSDN took over VFP’s sample code, and locating it wasn’t as simple as looking in HOME() + “\SAMPLES”, especially since both VFP and MSDN can be installed wherever you want to put them (and, once installed, MSDN’s paths are long and difficult to remember). This variable was added to make it easier to find the samples when you want to look them over for ideas, take advantage of some item located there in your own code, or just use them for giving demos. In VFP 7, the samples again belong to the FoxPro directory tree (a consequence of pulling VFP out of Visual Studio, no doubt), but we still have this handy variable, which is much simpler to type than a path, anyway.

HOME(2) contains the same value. In fact, changing _SAMPLES changes the return value of HOME(2). Of course, changing _SAMPLES doesn’t move the samples; so think twice before you change the variable. The location of the samples is stored in the Registry and _SAMPLES gets its value from there, but changing _SAMPLES, then using Tools | Options and choosing Set as Default does store the new value.

Example

USE (_SAMPLES + "TasTrade\Data\customer" )

See Also

Home()