[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

where is Main in this case?

Posted on 2006-10-19
2
Medium Priority
?
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 2000 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:K V
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

650 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