EDIT::
This might be simple for some but right now it has me confused. I am working on a project and when the submit button is pressed,create either a person or an employee based on the above checkbox. Put all of the form data into the class object using either the constructor or properties. Display all of the class information using the ToString method and a messagebox.
My question is::
When it is asking when the submit button is pressed, create a person or an employee based on the above checkbox.Would I use what is above the checkbox or below.
Also to put all of the form data into the class object using either the constructors or properties. I’m Not to sure how to do this.
Display all of the class information using a ToString and a messagebox. I understand how to do a messagebox but not with a ToString.
Now I already have two classes and those names are Members and Employees. Under the Members I have Name, Age, and COB. Under the employees I have Salary and JobTitle. The only time that the salary and jobtitle comes up if the user check the checkbox that says is person employee.
I am sorry if I confuse people I myself is kinda confused with what is being asked. The software I am using is Microsoft Visual C# 2010 Expressed.
The code I have so far don’t know if it is right or not:
private void button1_Click(object sender, EventArgs e)
{
Members obj = new Members(); <---This is what is I am assuming being asked when
obj.Name = ""; its says create either a person or an employee
obj.Age = ""; based on the above checkbox.
obj.COB = "";
Employess obj1 = new Employess(); <-- here I am trying to put all of the form
obj1.Salary = ""; data into the class object using either
obj1.JobTitle = ""; the constructor or properties.
Console.WriteLine(obj.ToString());<--- this is the messagebox I am being asked to do its not all the way done.
}
From what I get from your code is you have taken two classes for employees and members and you want to store their information in objects of respective classes based upon your checkbox selection. I suppose you are working in windows forms because you have specified the button_click event.
If that’s the case: