Visual Basic Race Results program

September 28, 2015 at 16:04:44
Specs: Windows 7
Help! I need help on allowing a user input names and race scores and then having the program order the racers by their score
Private Sub btnCalculateResults_Click(sender As Object, e As EventArgs) Handles btnCalculateResults.Click
Dim intFinishName1 As String
Dim intFinishName2 As String
Dim intFinishName3 As String
Dim intFinishTime1 As Integer
Dim intFinishTime2 As Integer
Dim intFinishTime3 As Integer

Try
intFinishTime1 = CInt(txtTime1.Text)
intFinishTime2 = CInt(txtTime2.Text)
intFinishName3 = CInt(txtTime3.Text)
Catch ex As Exception
MessageBox.Show("Time scores must be numeric.", "Error")
Return
End Try
'Calculate and display the winner
If intFinishTime1 < intFinishTime2 And intFinishTime2 < intFinishTime3 Then
lblResult1.Text = intFinishName1
lblResult2.Text = intFinishName2
lblResult3.Text = intFinishName3
End If
If intFinishTime1 > intFinishTime2 And intFinishTime2 < intFinishTime3 Then
lblResult1.Text = intFinishName1
lblResult2.Text = intFinishName2
lblResult3.Text = intFinishName3
End If
If intFinishTime1 < intFinishTime2 And intFinishTime2 > intFinishTime3 Then
lblResult1.Text = intFinishName1
lblResult2.Text = intFinishName2
lblResult3.Text = intFinishName3
End If
If intFinishTime1 > intFinishTime2 And intFinishTime2 < intFinishTime3 Then
lblResult1.Text = intFinishName1
lblResult2.Text = intFinishName2
lblResult3.Text = intFinishName3
End If
If intFinishTime1 > intFinishTime2 And intFinishTime2 > intFinishTime3 Then
lblResult1.Text = intFinishName1
lblResult2.Text = intFinishName2
lblResult3.Text = intFinishName3
End If
End Sub

message edited by blakec.cross


See More: Visual Basic Race Results program

Report •

#1
October 13, 2015 at 05:11:01
It looks like regardless of results you are putting the same

lblResult1.Text = intFinishName1
lblResult2.Text = intFinishName2
lblResult3.Text = intFinishName3

If I understand your program, not being a visual Basic programmer, that means no matter what the time is the same player is first?

Otherwise is there another part where it fails?

::mike


Report •
Related Solutions


Ask Question