This program lets you enter the name, and time of 3 runners. Then it displays them in First, Sencond and third place. All i get at the end results is the number 0. What am i doing wrong? Please any help is greatly appreciated!
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click'Declare variables
Dim sngRunner1Time As Single
Dim sngRunner2Time As Single
Dim sngRunner3Time As SingleDim intFirst As Integer
Dim intSecond As Integer
Dim intThird As IntegerIf sngRunner1Time > sngRunner2Time And sngRunner1Time > sngRunner3Time Then
intFirst = txtRunner1.Text
End If
If sngRunner2Time > sngRunner1Time And sngRunner2Time > sngRunner3Time Then
intSecond = txtRunner2.Text
End If
If sngRunner3Time > sngRunner1Time And sngRunner3Time > sngRunner2Time Then
intThird = txtRunner3.Text
End If'Display output
lblFirst.Text = intFirst
lblSecond.Text = intSecond
lblThird.Text = intThird
You never populate sngRunner1Time, sngRunner2Time, nor sngRunner3Time. You try to assign a String to an Integer
The logic of your If statements is screwed up.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |