Solved

where is Main in this case?

Posted on 2006-10-19
2
163 Views
Last Modified: 2010-04-16
public class TaxReturn holds all information for a tax return;
public class aForm : Form creates a form to enter and change that tax information.

so where should Main go, in TaxReturn or aForm?

is this right? --

    public static void Main()
    {
      TaxReturn mine = new TaxReturn();
      Application.Run(new aForm());
    }

thank you.
0
Comment
Question by:mtnr
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17771752
In Windows application function of Main function is to create and run main application window. In your version, aForm doesn't know anything about TaxReturn, this doesn't make sence. It is better to keep TaxReturn member in the form class:

    public static void Main()
    {
      Application.Run(new aForm());
    }

class aForm: Form
{
    TaxReturn mine;

    public aForm()
    {
           mine = new TaxReturn();

           ...
    }

    ...
}
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 17771885
AlexFM is perfact !
as aForm handles event on TaxReturn, its better to make it mamber of aForm as you can easily work upon it.
If ur creationg more than 1 TaxReturn objects, instead of using "Constructor" to initiate.. use that perticular event to do "new TaxReturn()"..

one more reason for trust him :- click on "AlexFM". ;)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question