Solved

where is Main in this case?

Posted on 2006-10-19
2
160 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bulid json format 3 46
Need a complete list of ASP.NET page load events 3 28
Problem to error 4 45
Class object 2 27
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now