Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SetMain Method
Collapse the table of content
Expand the table of content

SetMain Method

Visual Studio .NET 2003

Sets the main file in a project.



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.


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

MainFile Property

Applies To: Project Object

© 2015 Microsoft