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.

Run

Some keywords just plain have too many meanings in FoxPro. Run is definitely in this category. This version is a method of the File object. Not surprisingly, it executes the file.

Usage

filFile.Run

Calling this method is just like clicking the Run button in the Project Manager. Programs, queries, forms, menus and applications run. For reports and labels, the Run Method is like clicking the Preview button. Bizarre, but it makes sense since in the Project Manager, the Run button turns into a Preview button when a report has focus. In the same vein, tables get browsed. Other kinds of files do nothing. Regardless of what actually happens, the method returns .T.

Just like when you run things from the PM, there’s no way to pass parameters to the called file. This could be a problem if what you’re trying to do programmatically with your project is test it.

If the project has an associated project hook, the QueryRunFile event fires before the file runs. That gives you a chance to react to the call.

Example

_VFP.ActiveProject.Files[3].Run

See Also

File, Project, QueryRunFile