I'm finally getting up to speed on VS 2005 and see that there is now a class
named Program that contains the main entry point for Windows Forms
applications. Yes, I understand that this is something that VS creates for
us and that we are not *required* to use it as is.

My question:
Are many of you who are writing non trivial Windows Forms applications
keeping this Program.cs file as generated by VS? Are you using it "as is" or
do you throw other things in there? If so, what else do you add to
Program.cs?

(just wondering what most developers think of this change and how you are
using it).

Thanks.

Re: Use of Program.cs by Nicholas

Nicholas
Tue Jul 18 12:53:40 CDT 2006

Jeremy,

Personally, I think it is a good thing, as it promotes encapsulation
(why have the startup code in the form? It might not have anything to do
with that).

I will add some code to that file easily, but in general, I think it is
better than the old template.

In the end, it is a class in the project like any other. You can modify
it how you wish.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Jeremy" <A@B.COM> wrote in message
news:u4VP4GpqGHA.3648@TK2MSFTNGP03.phx.gbl...
> I'm finally getting up to speed on VS 2005 and see that there is now a
> class named Program that contains the main entry point for Windows Forms
> applications. Yes, I understand that this is something that VS creates for
> us and that we are not *required* to use it as is.
>
> My question:
> Are many of you who are writing non trivial Windows Forms applications
> keeping this Program.cs file as generated by VS? Are you using it "as is"
> or do you throw other things in there? If so, what else do you add to
> Program.cs?
>
> (just wondering what most developers think of this change and how you are
> using it).
>
> Thanks.
>



Re: Use of Program.cs by Mythran

Mythran
Tue Jul 18 12:56:31 CDT 2006


"Jeremy" <A@B.COM> wrote in message
news:u4VP4GpqGHA.3648@TK2MSFTNGP03.phx.gbl...
> I'm finally getting up to speed on VS 2005 and see that there is now a
> class named Program that contains the main entry point for Windows Forms
> applications. Yes, I understand that this is something that VS creates for
> us and that we are not *required* to use it as is.
>
> My question:
> Are many of you who are writing non trivial Windows Forms applications
> keeping this Program.cs file as generated by VS? Are you using it "as is"
> or do you throw other things in there? If so, what else do you add to
> Program.cs?
>
> (just wondering what most developers think of this change and how you are
> using it).
>
> Thanks.
>

When I use VS2K5, I normally either keep Program.cs or change it to
something else (something that I've used is InternalMain, which is just the
same as Program.cs). Inside this class I will normally have any
command-line argument parsing/functionality so that I can just have this
part done with before the rest of the app loads (forms).

But that's just me :)

HTH,
Mythran



Re: Use of Program.cs by Brian

Brian
Tue Jul 18 13:01:03 CDT 2006

Jeremy,

I think it's a good idea. It provides a logical place to put entry
point code. I have since started adopting the convention for 1.1
application as well. I often tinker around with the code inside the
Main method like choosing to run the application as a windows service
or winform application, processing command line arguments, etc.

Brian

Jeremy wrote:
> I'm finally getting up to speed on VS 2005 and see that there is now a class
> named Program that contains the main entry point for Windows Forms
> applications. Yes, I understand that this is something that VS creates for
> us and that we are not *required* to use it as is.
>
> My question:
> Are many of you who are writing non trivial Windows Forms applications
> keeping this Program.cs file as generated by VS? Are you using it "as is" or
> do you throw other things in there? If so, what else do you add to
> Program.cs?
>
> (just wondering what most developers think of this change and how you are
> using it).
>
> Thanks.


Re: Use of Program.cs by Andy

Andy
Tue Jul 18 13:03:36 CDT 2006

Yup, except I added a bunch to it, like throwing up a splash screen,
loading some initail data from the database and kicking off some
background threads, all before I show the main form.

When the form closes, it then cleans everything up.

Andy

Jeremy wrote:
> I'm finally getting up to speed on VS 2005 and see that there is now a class
> named Program that contains the main entry point for Windows Forms
> applications. Yes, I understand that this is something that VS creates for
> us and that we are not *required* to use it as is.
>
> My question:
> Are many of you who are writing non trivial Windows Forms applications
> keeping this Program.cs file as generated by VS? Are you using it "as is" or
> do you throw other things in there? If so, what else do you add to
> Program.cs?
>
> (just wondering what most developers think of this change and how you are
> using it).
>
> Thanks.


Re: Use of Program.cs by Roger

Roger
Tue Jul 18 14:01:25 CDT 2006

BTW, this is just like the project file in Delphi (dpr).

It is a good clean way to start off and perform
application initialization and precondition checks.

Roger