Public Class Form1 '////// CST112 B.A.Martin - avg pgm '//// Global declarations. Dim many As Integer = 0 ' How many values. Dim total As Integer = 0 ' Total (so far). Private Sub bEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bEnter.Click '//// Accumulate numbers into a total. '0. DECLARATIONS, INIT. Dim nextValue As Integer ' The next input # '1. INPUT: Get # from iNext nextValue = CInt(Me.iNext.Text) '2. PROCESS: Add n to total, increase many by 1.. total = total + nextValue many = many + 1 '3. OUTPUT: Display the total (so far). Me.oResults.Items.Add("The total (so far) is:" & Format(total)) End Sub Private Sub bAvg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bAvg.Click '//// Compute and display the average Dim avg As Double '1. INPUT: use global variables: total, many '2. PROCESS: Compute the average = total / many avg = total / many '3. OUTPUT: Display it. Me.oResults.Items.Clear() Me.oResults.Items.Add("The average is " & avg) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class