July 1st, 2010, 01:30 PM
How to read a delimetered line of strings and ints and extract them for processing
Hi, I have the following text file (ExamMarks.txt)
John, 85, 95, 90
Micheal, 60, 75, 75
I want to extract a line and take the Name and separately and the ints separately. Then I want to print the name and the average of the numbers like this in a label:
John's average is 90
Micheal's average is 70
So far I can only display what is in the text file in a label (see below):
|Dim FILE_NAME As String = "C:\ExamMarks.txt"
| Dim TextLine As String
| If System.IO.File.Exists(FILE_NAME) = True Then
| Dim objReader As New System.IO.StreamReader(FILE_NAME)
| Do While objReader.Peek() <> -1
| TextLine = TextLine & objReader.ReadLine & vbNewLine
| lblResults.Text = TextLine
| MsgBox("File Does Not Exist")
| End If
Any help is appreciated.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!