VB Running the Race Help!

November 4, 2010 at 11:03:04
Specs: Windows 7
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 Single

Dim intFirst As Integer
Dim intSecond As Integer
Dim intThird As Integer

If 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

See More: VB Running the Race Help!

Report •

November 4, 2010 at 12:28:23
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.

How To Ask Questions The Smart Way

Report •
Related Solutions

Ask Question