Thanks
*for the .letter part of my structure that is just there as a place holder to check to make sure it lined up with everything that will eventually be a function that will tell each students letter grade*
Data File: This is just part of the File there are 30 entries all together.
T.R. Alski 24 25 25 23 95.5
V.A. Borstellis 25 25 25 25 100.0
A.S. Reid 20 21 20 18 75.0
C.U. Tyler 19 20 21 24 75.5
H.A. Renee 20 23 23 25 80.5
I.A. Douglas 24 23 25 25 95.0
M.A. Elenaips 23 24 23 21 94.5
A.L. Emmet 21 19 18 15 73.0
S.U. James 21 24 23 22 87.5
Imports System.IO
Public Class frmMain
Structure student
Dim firstName As String
Dim lastName As String
Dim quiz1 As Integer
Dim quiz2 As Integer
Dim quiz3 As Integer
Dim quiz4 As Integer
Dim project As Double
Dim grade As Double
Dim letter As Char
End Structure
Const MAXSTUDENTS As Integer = 29
Private Sub btnReport_Click(sender As System.Object, e As System.EventArgs) Handles btnReport.Click
Dim allStudents(MAXSTUDENTS) As student
Dim reader As New StreamReader("studentData.txt")
Dim txtFile() As String = File.ReadAllLines("studentData.txt")
Dim fmtTitle As String = "{0,45}"
Dim fmtSubTitle As String = "{0,42}"
Dim fmtHead As String = "{0, -10} {1,-10} {2, -10} {3,-10} {4,-10} {5, -10} {6,-10} {7,-10} {8,-10}"
Dim counter As Integer = 0
lstReport.Items.Clear()
lstReport.Items.Add(String.Format(fmtTitle, "Ole Country School"))
lstReport.Items.Add(String.Format(fmtSubTitle, "Grade System"))
lstReport.Items.Add("")
lstReport.Items.Add(String.Format(fmtHead, "Name", "GPA", "Quiz 1", "Quiz 2", "Quiz 3", "Quiz 4", "Project", "Grade", "Letter"))
lstReport.Items.Add(String.Format(fmtHead, "-----", "---", "------", "------", "------", "-------", "-------", "-----", "------"))
txtFile = reader.ReadLine.Split(" "c)
With allStudents(counter)
.firstName = txtFile(0)
.lastName = txtFile(1)
.quiz1 = CInt(txtFile(2))
.quiz2 = CInt(txtFile(3))
.quiz3 = CInt(txtFile(4))
.quiz4 = CInt(txtFile(5))
.project = CDbl(txtFile(6))
.letter = CChar("A")
End With
counter += 1
For i As Integer = 0 To allStudents.GetUpperBound(0)
lstReport.Items.Add(String.Format(fmtHead, allStudents(i).firstName, allStudents(i).lastName, allStudents(i).quiz1,
allStudents(i).quiz2, allStudents(i).quiz3, allStudents(i).quiz4,
allStudents(i).project, "", allStudents(i).letter))
Next
End Sub
End Class

New Topic/Question
Reply



MultiQuote




|