-
July 1st, 2010, 12:30 PM
#1
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
|
| Loop
|
| lblResults.Text = TextLine
|
| Else
|
| MsgBox("File Does Not Exist")
|
| End If
Any help is appreciated.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|