if it were me. i'd
tryparse
add to list
at end
sort list / reverse
get list(0) and list(1)
Code:Dim scoreL As New List(Of Double) Dim highscore1, highscore2, score As Double highscore1 = Double.MinValue highscore2 = Double.MinValue 'test algorithm Dim somescores() As Double = New Double() {1, 15, 6, 32, 31, 4, 78, 3, 78, 80, 9, 10, 33, 79, 81} For Each s As Double In somescores Select Case s Case Is >= highscore1 highscore2 = highscore1 highscore1 = s Case Is > highscore2 highscore2 = s End Select Debug.WriteLine(highscore1.ToString() & " " & highscore2.ToString()) scoreL.Add(s) Next 'end test 'If Not Double.TryParse(TextBox3.Text, score) Then ' 'the textbox did not contain a Number ' Stop 'End If 'Select Case score ' Case Is >= highscore1 ' highscore2 = highscore1 ' highscore1 = score ' Case Is > highscore2 ' highscore2 = score 'End Select ''or ''scoreL.Add(score) ''scoreL.Sort() : scoreL.Reverse() '''highscore1 = scoreL(0) : highscore2 = scoreL(1) <<<<<<<<<< 'If highscore1 <> Double.MinValue Then TextBox1.Text = highscore1.ToString 'If highscore2 <> Double.MinValue Then TextBox2.Text = highscore2.ToString




Reply With Quote