Rem centimetros a pulgadas
Private Sub Command1_Click()
If (Text1 = "") Then Exit Sub
Text2 = Text1 * 0.3937
End Sub
Rem pulgadas a centimetros
Private Sub Command2_Click()
If (Text1 = "") Then Exit Sub
Text2 = Text1 * 2.54001
End Sub
Rem limpiar las cajas
Private Sub Command7_Click()
limpiar
End Sub
Rem metros a pies
Private Sub Command3_Click()
If (Text1 = "") Then Exit Sub
Text2 = Text1 * 3.2808
End Sub
Rem pies a metros
Private Sub Command4_Click()
If (Text1 = "") Then Exit Sub
Text2 = Text1 * 0.304801
End Sub
Rem metros a yardas
Private Sub Command5_Click()
If (Text1 = "") Then Exit Sub
Text2 = Text1 * 1.0936
End Sub
Rem yardas a metros
Private Sub Command6_Click()
If (Text1 = "") Then Exit Sub
Text2 = Text1 * 0.9144
End Sub
Rem autor del programa
Private Sub Command8_Click()
MsgBox "Programa creado por", 32, "Autor"
End Sub
Rem salir del programa
Private Sub Command9_Click()
salir
End Sub
Rem funciones de los botones y lo demas
Private Sub Form_Load()
If App.PrevInstance = False Then
Label1.Caption = "Medida"
Label2.Caption = "Resultado"
limpiar
Command1.Caption = "Centimetros a pulgadas"
Command2.Caption = "Pulgadas a centimetros"
Command3.Caption = "Metros a pies"
Command4.Caption = "Pies a Metros"
Command5.Caption = "Metros a yardas"
Command6.Caption = "Yardas a metros"
Command7.Caption = "limpiar las cajas"
Command8.Caption = "Autor del programa"
Command9.Caption = "Salir del programa"
' si se vuelve a ejecutar el programa en uso, cerrarlo
ElseIf App.PrevInstance = True Then
MsgBox "El programa esta en uso", 32, "Mensaje"
salir
End If
End Sub
Rem limpiar las cajas
Sub limpiar()
Text1.Text = ""
Text2.Text = ""
End Sub
Rem salir del programa
Sub salir()
Set Form1 = Nothing
End
End Sub
Rem por si se cierra el programa en el boton cerrar
Private Sub Form_Unload(Cancel As Integer)
salir
End Sub