unidades.txt 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 29/04/2005 6:48 '-----------------------------------------------------------------------------'// Programa ..... Unidades '// Autor ........ Jesús P.M. (zttSoft.com) '// Fecha ........ 07/04/2005 * Mod 07/04/2005 '-----------------------------------------------------------------------------Option Explicit Private Sub Form_Activate() txtVelocidad(0).Text = Format(0, "#,##0.00") txtVelocidad(1).Text = Format(0, "#,##0.00") End Sub '-----------------------------------------------------------------------------Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Image1.Move 4020, 1920 imgCambiar(0).Move 2160, 1740 imgCambiar(1).Move 2160, 300 End Sub '-----------------------------------------------------------------------------Private Sub Image1_Click() End End Sub '-----------------------------------------------------------------------------Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Image1.Move 4000, 1900 End Sub '-----------------------------------------------------------------------------Private Sub imgCambiar_Click(Index As Integer) Dim Resultado As Double If IsNumeric(txtVelocidad(0).Text) And IsNumeric(txtVelocidad(1).Text) Then Select Case Index Case 0 'A m/s Resultado = CDbl(txtVelocidad(0).Text) * 1000 / 3600 txtVelocidad(1).Text = Format(Resultado, "#,##0.00") txtVelocidad(1).SetFocus Case 1 'A km/h Resultado = CDbl(txtVelocidad(1).Text) * 3600 / 1000 txtVelocidad(0).Text = Format(Resultado, "#,##0.00") txtVelocidad(0).SetFocus Else End Select MsgBox "LOS VALORES DEBEN SER NÚMEROS ", 16, "¡ERROR!" txtVelocidad(0).Text = Format(0, "#,##0.00") txtVelocidad(1).Text = Format(0, "#,##0.00") End If End Sub '-----------------------------------------------------------------------------Private Sub imgCambiar_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Select Case Index Case 0 'A metros/segundo imgCambiar(0).Move 2140, 1720 Case 1 'A kilómetros/hora imgCambiar(1).Move 2140, 280 End Select End Sub '-----------------------------------------------------------------------------Private Sub txtVelocidad_GotFocus(Index As Integer) txtVelocidad(Index).SelStart = 0 txtVelocidad(Index).SelLength = Len(txtVelocidad(Index).Text) End Sub '-----------------------------------------------------------------------------Private Sub txtVelocidad_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii = 46 Then 'Coma=44 Punto=46 KeyAscii = 44 ' Cambiar a punto End If End Sub '-----------------------------------------------------------------------------Private Sub txtVelocidad_LostFocus(Index As Integer) txtVelocidad(Index).Text = Format(txtVelocidad(Index).Text, "#,##0.00") End Sub Page 1 of 2