Exam Result
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: Exam Result

  1. #1
    Join Date
    Jan 2014
    Posts
    1

    Post Exam Result

    I have a TEXTBOX with ABCDEFGHT on one side and a listbox that is reading a textfile with two column(first column = student name, second column = ABCDEGFYT). I would like to compare (the second column of the LISTBOX to the TEXTBOX content and have the result appear as a third column in the same TEXTBOX. I hope this time it's clear. thanks in advance. The language is VISUAL STUDIO.
    this is what I have so far:

    Code:
    Structure grades
            Dim student As String
            Dim grade As String
            Dim mark As String
            Dim average As String
            Dim order As String
        End Structure
        Dim place(9) As grades
    
        Private Sub frmGrade_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            If rbtCPC.Checked = True Then
                stanswers = IO.File.ReadAllLines("stanswers.txt")
            Else
                stanswers = IO.File.ReadAllLines("stanswers2.txt")
            End If
    
            Dim result() As String = stanswers       'should have read from your text file
            Dim grade As Integer = stanswers.Count - 1
            Dim line As String
            Dim data() As String
        
            For i As Integer = 0 To 9
                line = result(i)
                data = line.Split(","c)
                place(i).student = data(0)
                place(i).grade = data(1)
    
            Next
        End Sub
    
        Private     If rbtCPC.Checked = True Then
                answerkey = IO.File.ReadAllLines("answerkey.txt") ' read stanswers.txt into stanswers array
            Else
                answerkey = IO.File.ReadAllLines("answerkey2.txt") ' read stanswers.txt into stanswers array
            End If
            txtanswer.Text = answerkey(0) 
    
        End Sub
    
        Private Sub rbtCP2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtCP2.CheckedChanged
            If rbtCP2.Checked = True Then
                lstGrades.Items.Clear()
            Else
                rbtCPC.Checked = True
                lstGrades.Items.Clear()
            End If
        End Sub
        Dim Result As IO.StreamReader
    
        Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
            If rbtCPC.Checked = True Then
                Result = New IO.StreamReader("stanswers.txt")
            Else
                Result = New IO.StreamReader("stanswers2.txt")
            End If
            lstGrades.Items.Clear()
    
            While (Result.Peek() > -1)
                lstGrades.Items.Add(Result.ReadLine)
            End While
            Result.Close() Sub rbtCPC_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtCPC.CheckedChanged
          
        End Sub
    
        Private Sub btnAverage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAverage.Click
           
    
        End Sub
    
        Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
          
            txtanswer.Clear()
            txtAverage.Clear()
            txtHighest.Clear()
            txtLowest.Clear()
            lstAverage.Items.Clear()
            lstGrades.Items.Clear()
        End Sub
    
        Private Sub lstGrades_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstGrades.SelectedIndexChanged
           
        End Sub
    
        Private Sub lstAverage_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstAverage.SelectedIndexChanged
    
        End Sub
        Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
            Me.Close()
        End Sub
    End Class
    Last edited by GremlinSA; January 13th, 2014 at 02:48 AM. Reason: added code Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center