EXPERT SOLUTION:   Create a Windows Forms Application With Basic Controls and Add an Employee Class This part of the


Create a Windows Forms Application With Basic Controls and Add an Employee Class

This part of the project, you will create a Windows Forms application with an Employee class. Read the Project Guide provided and the project video link for instructions and details to help guide you through your efforts.

Project Files

Module 5 Project Guide (Links to an external site.)

Module 5 Project Template

Course Project
DeVry University
College of Engineering and Information Sciences

Screenshot of program running:

Form code (only the code for the form, not program.cs):

Course Project
DeVry University
College of Engineering and Information Sciences

Course Number: CEIS247


Course Number: CEIS209


This course project is designed to help you practice using your skills. Each week, you will learn important concepts. Then, you will apply these concepts to build an amazing course project over the next seven weeks. What’s more, this project will have a Graphical User Interface (GUI) instead of using the console. This course project has two parts. For the first couple of weeks, you will be create a basic GUI and learn how to work with GUI controls while practicing basic programming concepts. After that, you will create an object oriented project.

Part 2: Scenario

You have been hired as a consultant to create a basic Payroll System for a small business. The business wants to keep track of basic employee information and print paychecks for the employees every two weeks. Your client has some basic functionality in mind, such as the ability to add and remove employees, display basic employee information, and print paychecks. Maintenance is key! You realize that Object-Oriented programming will provide the most efficient application that is easy to maintain and update as needed. Let’s get started!

Week 5: Create a Windows forms application with basic controls and add an Employee Class


1. To start the course project

2. Design and create two Windows forms with GUI controls

3. Read from and update GUI control variables



1. Start Visual Studio. You will see a Start Page that looks something like this. Read through it, and then click the “Create a new project” tile near the bottom, right corner.

2. Create a new Windows Forms App (.NET Framework) – C# version. If you do not see Windows Forms App (.NET Framework), simply type “Windows Forms App” in the search box and choose the C# version. Then, hit the Next button.

3. When you configure your new project, call it “Lastname_CourseProject_part2”. Make sure you change the location to somewhere that you will find it easily! Then, click the Create button.

4. Make a new form. You should be presented with a blank form like the one below. You are now ready to start designing your form! Currently it is called Form1, which is both boring and poor programming practice. A form, as well as forms controls, should have meaningful names, just like all other variables.

Rename the form’s file in the Solution Explorer to MainForm. Then, add four Buttons and a ListBox to your form. Feel free to play with the Font, BackColor, or any other property! Have fun! The form above was set to a font size of 20. Feel free to do the same so your form looks like the one below.






Payroll System












Print Paychecks




Your main form should look something like this. If you hit the green Start arrow, your application will run! Congratulations, you have created your first form! Click on the little red square to stop the program execution and go back to the editor.

When we click the buttons, nothing happens. We have not “activated” the buttons yet. We need to add the code for each button to execute. When you double-click on a button, Visual Studio will create the Event Handler and the method to go with the event. For example, when you double-click on the Add button, Visual Studio will write this line to handle the event:

this.AddButton.Click += new System.EventHandler(this.AddButton_Click);

When a user clicks the AddButton, C# will run the “AddButton_Click” method. I highlighted the event and the method for clarity. In other words, the code that you put into the AddButton_Click will be executed when the user clicks the AddButton!

When the user clicks the AddButton, simply add a “New Employee” string to the employees listbox. When the user clicks the RemoveButton, get the selected item number (index) and remove the item at that item number. Check and make sure something is selected! When the user clicks the DisplayButton or the PrintPaychecksButton, show a message so the user knows that the button code has not been completed. When you finish, the code should look something like this:

using System;

using System.Windows.Forms;

namespace LastName_CourseProject_part2


public partial class MainForm : Form


public MainForm()




private void AddButton_Click(object sender, EventArgs e)


// add item to the employee listbox

EmployeesListBox.Items.Add(“New Employee”);


private void RemoveButton_Click(object sender, EventArgs e)


// remove the selected item from the employee listbox

int itemNumber = EmployeesListBox.SelectedIndex;

if(itemNumber > -1 )






MessageBox.Show(“Please select employee to remove.”);



private void DisplayButton_Click(object sender, EventArgs e)


MessageBox.Show(“Displaying all employees…”);


private void PrintPaychecksButton_Click(object sender, EventArgs e)


MessageBox.Show(“Printing paychecks for all employees…”);




Create an Employee class to encapsulate the employee information. It is much easier to work with a single Employee object instead of working with many separate variables. If I have fifty employee objects, I can get the details for an employee by simply asking the employee using the dot operator. For example, we can get the employee’s first name by using the dot operator and selecting the FirstName property:


Think about it. If I do not use encapsulation, I will need to create an array for each attribute that I want to track. Imagine having to maintain an application with as many as thirty arrays to track the details for the fifty employees! In the past, we used “parallel arrays” to track all of this information. Now, we use object-oriented programming with encapsulation to make our lives a lot easier! With encapsulation, the Employee object encapsulates or contains all of the details that we need to know about the employee. When we need a piece of information, we simply ask the Employee object using the dot operator!

We also need to implement “data hiding”. Data hiding simply means that we make our attributes or “data” hidden outside of the class. If someone wants to change one of the attributes, they will need to use our property. Our property will contain accessors and mutators. Accessors allow the outsider to “access” or get the attribute value. Mutators allow the outsider to “mutate” or “change” or set the attribute value. Since the outsider is forced to use our property, we can validate the information that the outsider is trying to give us. If the information is not valid, we can ignore it. By validating the inputs, we can protect our data.

Create an Employee class that encapsulates the important information that we want the Employee objects to contain. In addition, implement data hiding techniques to help reduce hacking and to protect our data! Here is the UML class diagram for the Employee class. Since we have no idea how to pay the generic employee, the CalculatePay( ) behavior should simply return zero.

Deliverables Week 5

· Use the Word document template and put your information at the top. Take a screenshot while your application is running. Paste the screenshot to a Word document below your information. Finally, copy-paste your Form code (only the code for the form, not program.cs) to the Word document below the screenshot. Paste a screenshot of your Employee class. Save and close your Word document. Submit the Word document for your first Course Project deliverable.

Employee- firstName : string+ ToString( ) : string- lastName : string- ssn : string- hireDate : DateTime+ CalculatePay( ) : double

– firstName : string
+ ToString( ) : string
– lastName : string
– ssn : string
– hireDate : DateTime
+ CalculatePay( ) : double

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more