468,780 Members | 2,297 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,780 developers. It's quick & easy.

Startup object

cj
In 2003 I sometimes changed the startup object of a project to Sub Main
which was found in Module1.vb. I upgraded one such project to 2005 and
I notice in the properties page for the project that nothing is selected
as the startup object. It appears to function but should I set it to
Sub Main?
Jan 12 '07 #1
8 3283
cj
I just noticed on projects created from scratch in 2005 the checking and
unchecking of "enable application framework" affects this. Can anyone
point me to some basic and brief info on how this relates to what I was
used to in 2003? I'm Googling now.

cj wrote:
In 2003 I sometimes changed the startup object of a project to Sub Main
which was found in Module1.vb. I upgraded one such project to 2005 and
I notice in the properties page for the project that nothing is selected
as the startup object. It appears to function but should I set it to
Sub Main?
Jan 12 '07 #2

I"m in the same boat dude.
A little too much vb.net voodoo going on.

"cj" <cj@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
I just noticed on projects created from scratch in 2005 the checking and
unchecking of "enable application framework" affects this. Can anyone
point me to some basic and brief info on how this relates to what I was
used to in 2003? I'm Googling now.

cj wrote:
In 2003 I sometimes changed the startup object of a project to Sub Main
which was found in Module1.vb. I upgraded one such project to 2005 and
I notice in the properties page for the project that nothing is selected
as the startup object. It appears to function but should I set it to
Sub Main?

Jan 12 '07 #3
cj
Deep voodoo. And it'll probably all change again in a couple of years.
They'll be promoting a new, better and very different way of doing things.
sloan wrote:
I"m in the same boat dude.
A little too much vb.net voodoo going on.

"cj" <cj@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
>I just noticed on projects created from scratch in 2005 the checking and
unchecking of "enable application framework" affects this. Can anyone
point me to some basic and brief info on how this relates to what I was
used to in 2003? I'm Googling now.

cj wrote:
>>In 2003 I sometimes changed the startup object of a project to Sub Main
which was found in Module1.vb. I upgraded one such project to 2005 and
I notice in the properties page for the project that nothing is selected
as the startup object. It appears to function but should I set it to
Sub Main?

Jan 12 '07 #4

I also checked.

C# does a nice little Program.cs thing for you:

Ahhhhh! VB.Net 2005 just took a dufous step back to vb6/vb5/vb4. I can't
speak past vb4.

using System;

using System.Collections.Generic;

using System.Windows.Forms;

namespace MyApp

{

static class Program

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(fals e);

Application.Run(new MainForm());

}

}

}


"cj" <cj@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Deep voodoo. And it'll probably all change again in a couple of years.
They'll be promoting a new, better and very different way of doing
things.
>

sloan wrote:
I"m in the same boat dude.
A little too much vb.net voodoo going on.

"cj" <cj@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
I just noticed on projects created from scratch in 2005 the checking
and
unchecking of "enable application framework" affects this. Can anyone
point me to some basic and brief info on how this relates to what I was
used to in 2003? I'm Googling now.

cj wrote:
In 2003 I sometimes changed the startup object of a project to Sub
Main
>which was found in Module1.vb. I upgraded one such project to 2005
and
>I notice in the properties page for the project that nothing is
selected
>as the startup object. It appears to function but should I set it to
Sub Main?

Jan 12 '07 #5
MS thinks WinForm applications should always start with a form.

So in VB2005, if you want to start with a static method
(Sub Main), you can do that, but MS assumes it's not going to be
a WinForm application. Just select the class name that contains
the Sub Main in the Startup Object combo box on the Application
page of the My Project designer.

For this option to be available, you have to have the
Enable Application Framework option disabled, because
that is used for Windows Forms applications.

You can enable the XP styles manually if you choose to do so.
According to Francesco Balena's "Standard Practices" book, you
should invoke Application.DoEvents right after enabling the
visual styles because there's some bug in int. They may have
fixed this in VB2005, though. He gives a link:
http://www.codeproject.com/buglist/E...lStylesBug.asp

Robin S.
------------------------------------------------------
"cj" <cj@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
>I just noticed on projects created from scratch in 2005 the checking
and unchecking of "enable application framework" affects this. Can
anyone point me to some basic and brief info on how this relates to
what I was used to in 2003? I'm Googling now.

cj wrote:
>In 2003 I sometimes changed the startup object of a project to Sub
Main which was found in Module1.vb. I upgraded one such project to
2005 and I notice in the properties page for the project that nothing
is selected as the startup object. It appears to function but should
I set it to Sub Main?

Jan 15 '07 #6
Hi Cj,

About the startup object, VS2005 is compatible with VS.NET 2003.

In VS.NET 2003, we could select a form or a module that contains Sub Main
procedure, or just Sub Main if Sub Main procedure is declared only once in
the project, as the startup object.

It's same in VS2005. In addition, VS2005 instroduce a new option of 'Enable
application framework' which specifies whether or not a Windows application
project will start with a custom Sub Main procedure (that you have
created).

If you enable the application framework, your application uses the standard
Sub Main. If you disable the application framework, your application could
use the custom Sub Main.

When a VS.NET 2003 Windows application project is upgraded to VS2005, the
startup object remains unchanged. However, the problem is that if we set
Sub Main as startup object in the VS.NET 2003 project and then upgrade it
to VS2005, the 'Startup object' option in the project designer is not set.
I have performed a test and confirmed this. I also found that if I set the
startup object to a form or a module, the form or module is set as the
startup object in the project designer in upgraded project.

I think this may be a limitation of VS2005 when upgrading projects.
Although it still functions, I suggest that you set the startup object to
Sub Main or some other things in the project designer for the upgraded
project, lest this may cause confusion for other developers.

Hope this helps.
If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 15 '07 #7
cj
Thanks!

RobinS wrote:
MS thinks WinForm applications should always start with a form.

So in VB2005, if you want to start with a static method
(Sub Main), you can do that, but MS assumes it's not going to be
a WinForm application. Just select the class name that contains
the Sub Main in the Startup Object combo box on the Application
page of the My Project designer.

For this option to be available, you have to have the
Enable Application Framework option disabled, because
that is used for Windows Forms applications.

You can enable the XP styles manually if you choose to do so.
According to Francesco Balena's "Standard Practices" book, you
should invoke Application.DoEvents right after enabling the
visual styles because there's some bug in int. They may have
fixed this in VB2005, though. He gives a link:
http://www.codeproject.com/buglist/E...lStylesBug.asp

Robin S.
------------------------------------------------------
"cj" <cj@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
>I just noticed on projects created from scratch in 2005 the checking
and unchecking of "enable application framework" affects this. Can
anyone point me to some basic and brief info on how this relates to
what I was used to in 2003? I'm Googling now.

cj wrote:
>>In 2003 I sometimes changed the startup object of a project to Sub
Main which was found in Module1.vb. I upgraded one such project to
2005 and I notice in the properties page for the project that nothing
is selected as the startup object. It appears to function but should
I set it to Sub Main?

Jan 15 '07 #8
cj
Thanks!

Linda Liu [MSFT] wrote:
Hi Cj,

About the startup object, VS2005 is compatible with VS.NET 2003.

In VS.NET 2003, we could select a form or a module that contains Sub Main
procedure, or just Sub Main if Sub Main procedure is declared only once in
the project, as the startup object.

It's same in VS2005. In addition, VS2005 instroduce a new option of 'Enable
application framework' which specifies whether or not a Windows application
project will start with a custom Sub Main procedure (that you have
created).

If you enable the application framework, your application uses the standard
Sub Main. If you disable the application framework, your application could
use the custom Sub Main.

When a VS.NET 2003 Windows application project is upgraded to VS2005, the
startup object remains unchanged. However, the problem is that if we set
Sub Main as startup object in the VS.NET 2003 project and then upgrade it
to VS2005, the 'Startup object' option in the project designer is not set.
I have performed a test and confirmed this. I also found that if I set the
startup object to a form or a module, the form or module is set as the
startup object in the project designer in upgraded project.

I think this may be a limitation of VS2005 when upgrading projects.
Although it still functions, I suggest that you set the startup object to
Sub Main or some other things in the project designer for the upgraded
project, lest this may cause confusion for other developers.

Hope this helps.
If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Jan 15 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by cefrancke | last post: by
4 posts views Thread by Tony Vitonis | last post: by
4 posts views Thread by Chris Ashley | last post: by
reply views Thread by mark | last post: by
4 posts views Thread by Johnnie Miami | last post: by
12 posts views Thread by chinkuang | last post: by
10 posts views Thread by Bernie Hunt | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.