?
Solved

where is Main in this case?

Posted on 2006-10-19
2
Medium Priority
?
166 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

Independent Software Vendors: 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 introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
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 brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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