SetMain Method

Sets the main file in a project.

Object.SetMain([cFileName [, cActiveDocClass]])

Parameters

  • cFileName
    Specifies a file in the project to set as the main file. The main file can be a program, form, or a visual class library containing an Active Document class. Be sure to include the file extension in cFileName. If cFileName is omitted or is the empty string, no file in the project is set as the main file.
  • cActiveDocClass
    Specifies an Active Document class to set as the main file. To specify an Active Document class as the main file, cFileName must be the name of the visual class library containing the Active Document class.

Remarks

The SetMain method returns true (.T.) if the file or Active Document class you specify is set as the main file. False (.F.) is returned if the file or Active Document class you specify isn't in the project or the file you specify isn't the proper file type.

The main file is a program (.prg file), form (.scx file), or Active Document class 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 or Active Document class as the main file in a project also sets the project's MainFile and MainClass properties.

See Also

MainClass Property | MainFile Property

Applies To: Project Object