473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Use of Program.cs

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.
Jul 18 '06 #1
5 3912
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]
- mv*@spam.guard.caspershouse.com

"Jeremy" <A@B.COMwrote in message
news:u4**************@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.

Jul 18 '06 #2

"Jeremy" <A@B.COMwrote in message
news:u4**************@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
Jul 18 '06 #3
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.
Jul 18 '06 #4
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.
Jul 18 '06 #5
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
Jul 18 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
22
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html ...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
11
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >>...
1
by: Eric Whittaker | last post by:
hi all, im trying to write my first c++ program. a success, but i can't get the window to stay open after user enters input. it just automatically closes. right now the end of my program looks...
9
by: Hemal | last post by:
Hi All, I need to know the memory required by a c program. Is there any tool/utility which can give me the memory usage in terms of DATA segment, TEXT segment, BSS segment etc. I am working...
7
by: ibtc209 | last post by:
I just started programming in C, and I need some help with this problem. Your program will read the information about one MiniPoker hand, namely the rank and suit of the hand’s first card, and...
2
Banfa
by: Banfa | last post by:
Posted by Banfa The previous tutorial discussed what programming is, what we are trying to achieve, the answer being a list of instructions constituting a valid program. Now we will discuss how...
0
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.