First off, Thanks again for all your guys help :)

I worked on a project where the user was supposed to enter numbers one at a time. After each number is entered, the program is to display the number of inputs, the total numbers entered, the average, the maximum and the minimum.

But what I am trying to accomplish now (just to further myself in this field) is: Instead of the user entering numbers one at a time as in my orginal program, I want the program to read the input numbers from a text file. When the first number is requested, that data file is to be opened and the first number read and processed. The file is then to be left open for the rest of the numbers to be read. When the program is at its end, the file will be closed. A restart button is to allow the orginal file or another file to be read from the beginning.

----Orginal Project----

[Public Class Form1
Dim InpNumber, InpTotal, InpCount, InpAverage As Double
Dim InpMaximum, InpMinimum As Double

Private Sub BtnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEnter.Click
InpNumber = CDbl(txtInput.Text)

If InpCount = 0 Then
InpTotal = InpNumber
InpAverage = InpNumber
InpMinimum = InpNumber
InpMaximum = InpNumber
InpCount = InpCount + 1

Else
InpCount = InpCount + 1
InpTotal = InpTotal + InpNumber
InpAverage = InpTotal / InpCount
End If

If InpMinimum > InpNumber Then
InpMinimum = InpNumber
End If

If InpMaximum < InpNumber Then
InpMaximum = InpNumber
End If


txttotal.Text = CStr(InpTotal)
txtaverage.Text = CStr(InpAverage)
txtmin.Text = CStr(InpMinimum)
txtmax.Text = CStr(InpMaximum)
txtcount.Text = CStr(InpCount)
End Sub

Private Sub BtnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnReset.Click
InpNumber = CDbl(txtInput.Text)

If InpNumber = InpNumber Then
InpTotal = 0
InpAverage = 0
InpMinimum = 0
InpMaximum = 0
InpCount = 0
InpNumber = 0
End If


txtInput.Text = CStr(InpNumber)
txttotal.Text = CStr(InpTotal)
txtaverage.Text = CStr(InpAverage)
txtmin.Text = CStr(InpMinimum)
txtmax.Text = CStr(InpMaximum)
txtcount.Text = CStr(InpCount)

End Sub

End Class]

u have posted the thread in the wrong forum. post it in the vb.net forum after that ur question will be answered.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.