iLabiLab Overview

12:18 PM MT
04/02/2017

iLab Overview

Scenario Summary

Create a Windows Forms application that references your component.

Deliverables

NOTE

Submit your assignment to the Dropbox, located at the top of this page. For instructions on how to use the Dropbox, read these step-by-step instructions.

(See the Syllabus section "Due Dates for Assignments & Exams" for due dates.)

You will create a Class Library project containing a single class. Then you will create a Windows Forms application that references your component.

Grading Rubric

The criteria used for grading your iLab are as follows.

Task /
Points
Add New Table to Data Source / 5 points
Create and Code All Payments and One Member Forms / 10 points
Test the Program (Screenshots) / 5 points
Create SQL Query to Create Table Adapter / 10 points
Connect Data Grid to Table Adapter / 5 points
Display Output (Screenshots) / 5 points
Save, and Zip All Necessary Files / 10 points
Total / 50 points

Required Software

Visual Studio 2012

Use a personal copy or access the software at

Lab Steps

Step 1: Open the Week 4 Karate School Manager

We will be adding more code to the Karate School Manager from Week 4. Open this project and make sure it is still running properly.

Step 2: Add a New Table to the Data Source

The payment table needs to be added to our data set. We can accomplish this by going back to the Data Sources window. You can find it under the View -> Other Windows -> Data Sources pull-down menu. The KarateDataSet will be visible.

Right-click the KarateDataSet and choose Configure Data Source with Wizard.

Add the Payments table to the Data Source. Payments will now appear in the Data Source window once you click Finish.

Step 3: Create AllPaymentsForm

Add a new form to the project named AllPaymentsForm.vb. Set its properties as follows: Text = List All Payments by Last Name; MaximizeBox = False; MinimizeBox = False; StartPosition = CenterScreen; FormBorderStyle = FixedDialog.

Step 4: Add Code to "All" in the Payments Menu

In MainForm, double-click the Payments -> All menu item and insert the following code in its event handler:
AllPaymentsForm.ShowDialog().

Step 5: Create Close SubMenu

Open AllPaymentsForm in Design view, add a MenuStrip control to the form, and create a File submenu with one selection: Close. In its Click event handler, insert the Me.Close() statement.

Step 6: Configure DataGridView

Place a DataGridView control on the form and name it dgvAllPayments.

Set its properties as follows: BackGroundColor = Control; BorderStyle = None; Anchor = Bottom, Left, Right; RowHeadersVisible = False.

Step 7: Set up Data Source

Using the smart tag in the grid’s upper right corner, set its data source to the Members table of KarateDataSet.

Uncheck adding, editing, and deleting.

Step 8: Test the All Payments

You should now be able to run the program and bring up the All menu under Payments.

Step 9: Create the OneMemberForm

Based on the knowledge you have gained over Weeks 4 and 5, create the form for One Member (OneMemberForm.vb) menu under the Payments drop-down menu. This form should allow the user to enter all or part of a member’s last name, then display the payments for all matching members. This is nearly identical to the Find Member form, except we are going to create a more powerful query. Add the DataGrid, but do not connect it to a table yet.

Step 10: Create a TableAdapter

Remember that a query is a request for data from one or more tables. We noticed that the All listing of payments did not include the name of the member, but instead just his or her Member_ID, which isn’t very useful. To solve this, we have to write a query that contains a two-table join and use it to create a “pseudotable” called a TableAdapter.

Go to the Data Sources window and open the KarateDataSet in the designer. We’re going to add a new TableAdapter to the two existing tables. Make sure neither table is selected, then right-click on the background and select Add -> TableAdapter.

Your prior data connection should be listed, so click Next.

Use SQL statements.

Enter the following SQL statement, then click Next.

SELECT Members.Last_Name, Members.First_Name, Payments.Payment_Date, Payments.Amount
FROM Members INNER JOIN Payments ON Members.ID = Payments.Member_Id
WHERE Members.Last_Name LIKE @name + '%')

On the next screen, name your method FindPayment and remove the Return a DataTable checkbox. On the next screen, click Finish.

You’ll then see the new data TableAdapter. Change its name to MemberPayment. It contains your query named FindPayment.

Go back to the Data Sources screen and you should see that this table has been added to KarateDataSet. If it is not there, you may have to run the wizard again to make it visible.

Step 11: Connect the DataGrid to the TableAdapter

Remember that this isn’t really a table, but a query that looks like a table. Use this MemberPayment table to connect your OneMemberFormDataGrid to the data. This is an identical process to what you have done over the last 2 weeks when building these forms. The result should look like this (notice that the letter T was searched on).

If you are feeling particularly clever, you should be able to go back to the All payments form and repeat the use of this adapter to display the output without member IDs.

Step 12: Turn It In

Create a Word document with several screenshots of your various forms in action. Use Alt+Print Screen to capture individual forms without capturing the entire desktop. Zip this document, along with your entire project directory, and submit to the iLab Dropbox.