Iniciar sesiónCrear cuenta

# Visual Basic - Ayuda HP Code VB

Vista:

## Ayuda HP Code VB

Publicado por DonGatoPR (3 intervenciones) el 06/12/2006 12:21:09
I need to write a program to calculate a horsepower, f = weight, d=distance and t=time, the formula is HP=(f * d) / (t * 550) .

By enter the weight and distance on a texbox and display the results on a listbox .

Use a For Loop to calculate the horsepower needed to lift the weight, where the value for time goes from 1 to 60 seconds, increment in units 2 seconds each time trough the loop.

Que estoy haciendo mal?
Este es el codigo que tengo hasta ahora....

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

Dim f As Integer

Dim d As Integer

Dim t As Integer = 1

Dim res As Integer

f = txtWeight.Text

d = txtDistance.Text

Do

Do While t < 60

t += 2

If t = 60 Then

t = False

Exit Do

End If

Loop

Loop Until t = False

res = CInt((f * d) / (t * 550))

End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click

lstDisplay.Items.Clear()

txtWeight.Text = "0"

txtDistance.Text = "0"

End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click

End

End Sub

End Class
Valora esta pregunta
0

## RE:Ayuda HP Code VB

Publicado por ricaurtem (313 intervenciones) el 07/12/2006 13:36:08
In Event Click of command button

Dim f as single, d as single, t as integer

f=val(txtweight.text)
d=val(txtdistance.text)

LstDisplay.Clear

For t=1 to 60 step 2

HP=(f * d) / (t * 550)

next

------------------------------------

To Clear

In event Click of command button (clear)

Txtweihgt.text=""
txtdistance.text=""
lstDisplay.clear

Good look
Valora esta respuesta
0