Visual Basic - Ayuda HP Code VB

Life is soft - evento anual de software empresarial
 
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) .

550 es una cantidad constante.

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))

lstDisplay.Items.Add(res.ToString)

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
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

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)

LstDisplay.Additem = HP

next

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

To Clear

In event Click of command button (clear)

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

Good look
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar