The following is the Object, Property, Setting, Event chart for the form controls, and each input field will have a label/input field pair. Also, group the related information in the associated group box
The form and form controls will be logically placed on the form, the controls aligned and sized, and a logical tab order assigned to each of the form controls.
Object
|
Property
|
Setting
|
frmHockeyStats
|
Text
|
Hockey Player Statistics
|
lblHeading
|
Text
|
Name, Course Title, Week Number, Lab Title
|
grpPlayer
|
Text
|
Player Information
|
lblFirstName
|
Text
|
First Name:
|
txtFirstName
|
Text
|
(empty)
|
lblLastName
|
Text
|
Last Name:
|
txtFirstName
|
Text
|
(empty)
|
lblSeasons
|
Text
|
Number of Seasons:
|
txtSeasons
|
Text
|
(empty)
|
lblAge
|
Text
|
Rookie Age
|
txtAge
|
Text
|
(empty)
|
grpStatistics
|
Text
|
Statistic Operations
|
btnGetStats
|
Text
|
Get Player Statistics
|
grpResults
|
Text
|
Season Results
|
lstSeasons
|
Items
|
(empty)
|
lblTotal
|
Text
|
(empty)
|
grpOperations
|
Text
|
Operations
|
btnClear
|
Text
|
Clear
|
btnExit
|
Text
|
Exit
|
You are free to experiment with colors and form design as you see fit. However, your application must meet the listed requirements.
Hint: Use constants for the lower and upper limits for the goals and assists. This will allow you to easily change the range limits in one place (see below). For example:
Private Const GOAL_LOWER_LIMIT As Integer = 0
Private Const GOAL_UPPER_LIMIT As Integer = 70
Private Const ASSIST_LOWER_LIMIT As Integer = 0
Private Const ASSIST_UPPER_LIMIT As Integer = 75
Private Const SEASONS_LOWER_LIMIT As Integer = 1
Private Const SEASONS_UPPER_LIMIT As Integer = 25
Private Const PLAYER_MIN_AGE As Integer = 18
Private Const PLAYER_MAX_AGE As Integer = 30
Hint: Declare the seasons, age, total goals, total assists, and total points variables as "form-level" variables at the top of the form and outside any module body. This will make these variables form-level variables and they can be accessed by any of the modules without having to pass them into the module through the argument list.
Private totalGoals As Integer = 0
Private totalAssists As Integer = 0
Private totalPoints As Integer = 0
Hint: An event handler can handle events from multiple controls, which allows you to modularize and reuse event handler code. For example:
Private Sub txtName_Validating(ByVal sender As Object, ByVal e AsSystem.ComponentModel.CancelEventArgs) Handles _
txtFirstName.Validating, _
txtLastName.Validating
Dim txtbox As TextBox = CType(sender, TextBox)
e.Cancel = ValidateStringInput("Name", txtbox.Text)
End Sub
Hint: Use the "sender" argument of each event handler to inspect the control that fired the event, but you need to convert the "object" to a textbox first, such as:
Dim txtbox As TextBox = CType(sender, TextBox)
e.Cancel = ValidateStringInput(datadescription, txtbox.Text)
Hint: Use the "IS" operator to see which control fires an event; for example:
If sender Is txtNumSeasons Then
process the number of seasons
ElseIf sender Is txtAge Then
'process the age
End If
Step 4: Implement the Event Handlers
|
Use the following as the design for your event handlers, referring to the flow chart for rules on input validation and processing. The final calculation SHOULD NOT be completed until all the input fields are validated.
Control Name
|
Event
|
Task
|
txtFirstName
|
Validating
|
Get player first name
Validate player name
|
txtLastName
|
Validating
|
Get player first name
Validate player name
|
txtSeasons
|
Validating
|
Get number of seasons
Validate number of seasons
|
txtAge
|
Validating
|
Get age
Validate age
Enable/disable get statistics command button
|
btnGetStats
|
Click
|
For each season
Get goals
Validate goals
Get assists
Validate assists
Calculate total goals
Calculate total assists
Calculate total points
Output season statistics in list
Next
Output season summary
|
btnClear
|
Click
|
Clear all textboxes and output labels
|
btnExit
|
Click
|
Close program (hint: use "Me.close")
|
frmHockeyStats
|
Load
|
Clear all textboxes and output label (hint: call the ClearFields module)
|
|
|