Karate Payments by a Single Member
Using the Karate School application from Tutorial 10-13 as a starting point, add a new form, shown in Figure 10-87, that lets the user view all payments made by a single member. The ListBox control displays a list of member names. When the user selects a name in the ListBox, the DataGridView control on the same form displays the payment date and amount of all payments made by the selected member.
You will need two data sources for this form:
1. The first one selects ID and (Last_Name + ‘,’ + First_Name) from the Members table, ordered by Last_Name.
2. The second data source selects Member_Id, Payment_Date, and Amount from the
Payments table listed in ascending order by Payment_Date. You will need to add a query to the TableAdapter of this dataset. The query returns payment rows that match a particular member ID value.
When the user selects a name from the ListBox, your event handler will obtain the SelectedValue property from the ListBox and assign its value to the query parameter for the query that fills the grid. In that way, the grid shows only payments by the selected member. In Design mode, when you bind the ListBox to the data source, be sure to assign ID to the ListBox’s ValueMember property.