Skip to content

Instantly share code, notes, and snippets.

@sriannamalai
Last active December 24, 2015 12:29
Show Gist options
  • Save sriannamalai/6797806 to your computer and use it in GitHub Desktop.
Save sriannamalai/6797806 to your computer and use it in GitHub Desktop.
Code to calculate the Winners from Runners based on their Finish Time
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim Runner1, Runner2, Runner3 As String
Dim FT1, FT2, FT3 As Decimal
Runner1 = txtRunner1.Text
Runner2 = txtRunner2.Text
Runner3 = txtRunner3.Text
FT1 = Convert.ToDecimal(txtFT1.Text)
FT2 = Convert.ToDecimal(txtFT2.Text)
FT3 = Convert.ToDecimal(txtFT3.Text)
If (FT1 > FT2 And FT1 > FT3) Then
lblFirst.Text = Runner1
If (FT2 > FT3) Then
lblSecond.Text = Runner2
lblThird.Text = Runner3
Else
lblSecond.Text = Runner3
lblThird.Text = Runner2
End If
ElseIf (FT2 > FT1 And FT2 > FT3) Then
lblFirst.Text = Runner2
If (FT1 > FT3) Then
lblSecond.Text = Runner1
lblThird.Text = Runner3
Else
lblSecond.Text = Runner3
lblThird.Text = Runner1
End If
ElseIf (FT3 > FT1 And FT3 > FT2) Then
lblFirst.Text = Runner3
If (FT1 > FT2) Then
lblSecond.Text = Runner1
lblThird.Text = Runner2
Else
lblSecond.Text = Runner2
lblThird.Text = Runner1
End If
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment