i need this program to display the 2 highest marks, but it only displays the highest mark twice, please help!
Code:Option Strict On Option Explicit On Public Class Form1 Dim highscore1, highscore2 As Double Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim score As Double score = CDbl(txtInput.Text) If score > highscore1 Then highscore1 = score If score > highscore2 Then highscore2 = score Else If highscore1 - score < 0 Then highscore1 = score Else If highscore2 - score < 0 Then highscore2 = score End If End If End If End If txtInput.Text = "0" End Sub Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click ListBox1.Items.Add("The two highscores are " & highscore1 & " and " & highscore2 & ".") End Sub End Class




Reply With Quote