SetMain Method

Sets the main file in a project.

Object.SetMain([cFileName])

Parameters

  • cFileName
    Specifies a file in the project to set as the main file. The main file can be a program or a form. Be sure to include the file extension in cFileName. If cFileName is omitted or is an empty string, no file in the project is set as the main file.

Remarks

Applies To: Project Object

The SetMain method returns true (.T.) if the file you specify is set as the main file. False (.F.) is returned if the file you specify is not in the project or the file you specify is not the proper file type.

The main file is a program (.prg file) or form (.scx file) that serves as the execution starting point for a compiled application, and from which other components of your application are called. Typically, the main file sets the application's operational environment, runs menu programs or forms to display the application's interface, and establishes the event loop of the application with the READ EVENTS command. You must designate a main file in the Project Manager before you can create an application (.app) or executable file (.exe) from the project.

Note

Specifying a file as the main file in a project also sets the project's MainFile property.

See Also

Reference

MainFile Property

Other Resources

Methods (Visual FoxPro)
Language Reference (Visual FoxPro)