Manual de Visual Basic Principiante

 

  Lección: 10

 

Capítulo: Ejercicio 8: Conversiones

 

 

 

 

Crea un formulario con dos etiquetas, dos cajas de texto, un marco, cuatro botones de opción, tres botones y escribe el siguiente código:

 

El botón Convertir

 

Private Sub Command1_Click()

 

If Option1 = True Then

 

Text2 = Val(Text1) * 1000

 

ElseIf Option2 = True Then

 

Text2 = Val(Text1) * 100

 

ElseIf Option3 = True Then

 

Text2 = Val(Text1) * 10

 

ElseIf Option4 = True Then

 

Text2 = Val(Text1) / 1000

 

End If

 

End Sub

 

El botón Nuevo Cálculo

 

Private Sub Command2_Click()

 

Text1 = ""

 

Text2 = ""

 

Text1.SetFocus

 

End Sub

 

El botón Salir

 

Private Sub Command3_Click()

 

Unload Me

 

End

 

End Sub

 

  Volver al índice!