Public Class Form1 Dim readervar As IO.StreamReader Dim fileName As String Dim total As Double = 0.0 Dim many As Integer = 0 Private Sub Btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn1.Click fileName = InputBox("What is the file", "", "C:\Users\Administrator\Documents\numbers.txt") readervar = IO.File.OpenText(fileName) Dim v As Integer Dim avg As Double Dim a As Double lstBox1.Items.Clear() '///// 1 a = readervar.ReadLine v = CInt(a) total += v many += 1 avg = total / many lstBox1.Items.Add("The next value is:" & a) If a > avg Then lstBox1.Items.Add("It is greater than average") ElseIf a < avg Then lstBox1.Items.Add("It is not greater than average") End If lstBox1.Items.Add("Count is:" & many) lstBox1.Items.Add("The total is:" & total) lstBox1.Items.Add("The average is:" & avg) lstBox1.Items.Add(" ") End Sub Private Sub Btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn2.Click Dim v As Integer Dim avg As Double Dim a As Double lstBox1.Items.Clear() '///// 1 a = readervar.ReadLine v = CInt(a) total += v many += 1 avg = total / many lstBox1.Items.Add("The next value is:" & a) If a > avg Then lstBox1.Items.Add("It is greater than average") ElseIf a < avg Then lstBox1.Items.Add("It is not greater than average") End If lstBox1.Items.Add("Count is:" & many) lstBox1.Items.Add("The total is:" & total) lstBox1.Items.Add("The average is:" & avg) lstBox1.Items.Add(" ") If readervar.Peek() < 0 Then lstBox1.Items.Clear() lstBox1.Items.Add(" End of the file") End If End Sub Private Sub Btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn3.Click lstBox1.Items.Clear() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class