A little bit too much php and c++ I suppose, but I can't remember VB for the life of me... and the prof isn't really feeling like refreshing my memory at all.
Writing a simple program that takes input from a CSV file... displays it and checks letter grade and computes numerical grade.
input sample
John,100,B
Sue,200,B
Joe,300,A
Tome,400,D
CODE
Public Class Form1
Dim path As String = "data.txt"
Dim infile As IO.StreamReader = IO.File.OpenText(path)
Dim items() As String
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
items = Split(infile.ReadLine, ",")
Dim strfmt As String = "{0,-10}{1,-20}{2,10}"
Dim counter As Integer = 0
Dim temp As Integer = 3
items = Split(infile.ReadLine, ",")
Do While infile.Peek <> -1
items = Split(infile.ReadLine, ",")
Loop
For counter = LBound(items) To UBound(items)
lstResults.Items.Add(items(counter))
counter = counter + 1
lstResults.Items.Add(items(counter))
counter = counter + 1
lstResults.Items.Add(items(counter))
Select Case items(counter)
Case "A"
lstResults.Items.Add("4")
Case "B"
lstResults.Items.Add("3")
Case "C"
lstResults.Items.Add("2")
Case "D"
lstResults.Items.Add("1")
Case "F"
lstResults.Items.Add("0")
End Select
counter = counter + 1
Next
End Sub
End Class
I'm going to do the formatting later...
I know it has to be something with how I'm reading in the data to the array from the txt file... because it is giving me an error that the array is out of bounds. I have my primer read.. etc.. is there a better method to read in than stream reader???
The way i thought it should work now is to go thru the while loop till the end of file... is there any way I can just make it stop on a certain value like noMore?
I'm not asking you guys to do my homework or anything, I just need some help and can't get to campus today. Thank you =)