Public Class Form1 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 '//// Add numbers into a total 'DECLARATION: Dim nextvalue As Integer 'the next imput # 'IMPUT: Get # from txt nextvalue = Val(Me.txt.Text) 'PROCESS: add n to total total = total + nextvalue many = many + 1 'OUTPUT: Display the total (so far) Me.OResult.Items.Add("the total (so far) is: " _ & Format(total)) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '///compute and display the average Dim avg As Double 'IMPUT: use global variables: total, many 'PROCESS: compute the average = total / many avg = total / many 'OUTPUT: display it Me.OResult.Items.Clear() Me.OResult.Items.Add("the average is " & avg) End Sub End Class