Hi Student101,
Your code was SO close to being finished that it took me all of 5 min to get it going. You were on the right track and everything was almost done.
Here is what I changed, I tried to comment as much as possible.
Private Sub cmdHighLow_Click()
Dim strName As String, intScore As Integer, intTheNumH As Integer, intTheNumL As Integer
'New Dim's
Dim CurHighScore As Integer
Dim CurLowScore As Integer
Dim CurHighPlayer As String
Dim CurLowPlayer As String
'Can't use these here since the values are not set yet.
'txths.Text = Str(intTheNumH)
'intTheNumH = CInt(intScore)
'txtls.Text = Str(intTheNumL)
'intTheNumL = CInt(intScore)
'txtln.Text = strName
'txthn.Text = strName
'A good habit to take is NOT to hardcode paths, use the App.Path
'property to find out where the Application is currently running.
Open App.Path & "\golfer.txt" For Input As #6
'Read the first line of the file and set this to be both High and
'Low scores, this is true since we've only read one line
Input #6, strName, intScore
CurHighScore = intScore
CurLowScore = intScore
CurHighPlayer = strName
CurLowPlayer = strName
Do Until EOF(6)
Input #6, strName, intScore
If intScore > CurHighScore Then
'If this player's score is higher than the current
'high score, set the high values
CurHighScore = intScore
CurHighPlayer = strName
ElseIf intScore < CurLowScore Then
'If this player's score is lower than the current
'low score, set the low values
CurLowScore = intScore
CurLowPlayer = strName
End If
Loop
Close #6
'Display the found values
txths.Text = Str(CurHighScore)
intTheNumH = CInt(intScore)
txtls.Text = Str(CurLowScore)
intTheNumL = CInt(intScore)
txtln.Text = CurLowPlayer
txthn.Text = CurHighPlayer
End Sub
As you can see there was not much to do. Also, as a suggestion for your own sanity down the road, take the habit of using App.Path for paths related to where your application is located. You can see how to use it in the Open statement.
Have fun and good luck
Yomet