aqui les dejo los comandos para hacer una calculadora con salida y botones de acciones
Visual Basic:
• 2 labels (Representa al signo = y los signos de operacion)
• 3 cajas de texto (2 para los numeros y una para el resultado)
• 4 botones (+,-,*,/)
• 2 botonesde limpieza y salir
Codigo:
para los signos
Private Sub Form_Load()
Label1 = ""
Label2 = "="
Text1 = ""
Text2 = ""
Text3 = ""
End Sub
boton sumar
Private Sub Command1_click()
Label1 = "+"
Text3 = Val(Text1) + Val(Text2)
End Sub
boton restar
Private Sub Command2_click()
Label1 = "-"
Text3 = Val(Text1) - Val(Text2)
End Sub
boton multiplicar
Private Sub Command3_click()
Label1 = "*"
Text3 = Val(Text1) * Val(Text2)
End Sub
Boton dividir
Private Sub Command4_click()
Label1 = "/"
Text3 = Val(Text1) / Val(Text2)
End Sub
Ya saben que el Label1 hay que colocarlo entre Text1 y Text2 ... y el Label2 va entre Text2 y Text3 !!!
En la propiedad 'Caption' de los 'Command' asignar signos de operacion ...
Command1 = +
Command2 = -
Command3 = *
Command4 = /
El botón Nuevo Cálculo
Private Sub Command5_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End Sub
boton de salida con pregunta que quiere hacer
If MsgBox("Por Favor Confirma Si Ya Te Quieres Ir", vbYesNo, "¿Qué Ya Te Quieres Ir?" = vbYes Then
End
Else
Cancel = 1
End If
espero que les sirva para un examen :
Visual Basic:
• 2 labels (Representa al signo = y los signos de operacion)
• 3 cajas de texto (2 para los numeros y una para el resultado)
• 4 botones (+,-,*,/)
• 2 botonesde limpieza y salir
Codigo:
para los signos
Private Sub Form_Load()
Label1 = ""
Label2 = "="
Text1 = ""
Text2 = ""
Text3 = ""
End Sub
boton sumar
Private Sub Command1_click()
Label1 = "+"
Text3 = Val(Text1) + Val(Text2)
End Sub
boton restar
Private Sub Command2_click()
Label1 = "-"
Text3 = Val(Text1) - Val(Text2)
End Sub
boton multiplicar
Private Sub Command3_click()
Label1 = "*"
Text3 = Val(Text1) * Val(Text2)
End Sub
Boton dividir
Private Sub Command4_click()
Label1 = "/"
Text3 = Val(Text1) / Val(Text2)
End Sub
Ya saben que el Label1 hay que colocarlo entre Text1 y Text2 ... y el Label2 va entre Text2 y Text3 !!!
En la propiedad 'Caption' de los 'Command' asignar signos de operacion ...
Command1 = +
Command2 = -
Command3 = *
Command4 = /
El botón Nuevo Cálculo
Private Sub Command5_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End Sub
boton de salida con pregunta que quiere hacer
If MsgBox("Por Favor Confirma Si Ya Te Quieres Ir", vbYesNo, "¿Qué Ya Te Quieres Ir?" = vbYes Then
End
Else
Cancel = 1
End If
espero que les sirva para un examen :

