HELP ME!!!!! Hi Score Table

middle1
10-30-2003, 09:23 PM
Quote:
--------------------------------------------------------------------------------
I have a text file with the following information (Hi Score List)

John, 67
Roger, 27
Henry, 28
will, 29
Matt, 17

I want to make Label1.caption = Matt's Score (i.e. 17).
Label2.caption = Roger's Score (i.e. 27)
How do I open the file and read each person's score (Not their name AND score).
--------------------------------------------------------------------------------



I am still having trouble with my program.

The Hi Score list could have any name or score in it.
I want the program to open the txt file as follows.

Open "c\:filename" For Input As # 1
Dim JohnScore As string
Line Input # 1, JohnScore 'I want the program to find John's SCORE in the file (i.e. 67) and display it on lablel1.
label1.caption = Val(JohnScore)
Line Input #1, Roger's Score, etc....
Close #1

ANY IDEAS!!!!!!!!!!!!!!!

passel
10-30-2003, 09:43 PM
Perhaps you can modify this to suit your need.
'
Dim nam As String, score As Long
Dim searchNam As String

On Error Resume Next
searchNam = "John"
Open "c:\score.txt" For Input As #1
Do Until EOF(1)
Input #1, nam, score
If nam = searchNam Then
Label1.Caption = score
Exit Do
End If
Loop
Close #1

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum