Export (0) Print
Expand All
Expand Minimize

StartupObject Property

Visual Studio .NET 2003

Returns or sets the entry point of the application.

[Visual Basic .NET]
Public Property StartupObject() As String
[Visual Basic 6]
Property Get StartupObject() As String
Property Let StartupObject( _
   ByVal Startup As String _
) 
[C++]
HRESULT __stdcall get_StartupObject(
   /* [out, retval] */ BSTR* retVal
);
HRESULT __stdcall put_StartupObject(
   /* [in] */ BSTR Startup
);
[C#]
string StartupObject {get; set;}
[JScript .NET]
public function get StartupObject() : String
public function set StartupObject(
   Startup: String
)

Parameters

Startup
Defines the class name for the entry point of the program. Use an empty string for class library projects (.dll file output).

Return Value

String. The name of the startup object for the program.

Remarks

The common language runtime must select a method to run when an application starts. For a Visual C# program this will be a static Main method defined in one of the program's classes. For Visual Basic, this will be the name of a form or a Sub Main in a module, class, or form.

For Windows projects written with Visual Basic, the default value for a new project is the main form in the application (ProjectName.Form1). Spaces in the project name are replaced with the underscore character "_". For all other projects, the default value is the empty string. When only the name of a form is specified, the runtime instantiates the form using its New method and shows the form.

For Windows projects written with C#, the default value is an empty string. If there is only one static Main in a project and the StartupObject property is blank, the runtime will use the single Main as the startup object. Since the default generated form for a new Windows project includes a Main method, the program will run the form as the startup object. If there is more than one static Main method, and the StartupObject property is blank, then the program will not execute.

This property is an empty string for class library projects, since they do not have an entry point. ASP.NET Web applications do not have a startup object, because they are class library projects. Web applications are created using the ASP.NET Web Application, XML Web Service, or Empty Web Project template in the New Project dialog box.

Example

See ProjectType Property.

See Also

General, Common Properties, <Projectname> Property Pages Dialog Box | General, Common Properties, <Projectname> Property Pages Dialog Box | /main (Visual Basic) | /main (Specify Location of Main Method) (Visual C#) | Application Class

Applies To: Properties Property (General Extensibility) | Properties Property (Visual Basic and Visual C# Project Object)

Show:
© 2015 Microsoft