lunes, 12 de noviembre de 2007


CALCULADORA BASICA
Este es un programa donde el usuario podrá ingresar dos números en el cual puede realizar operaciones básicas como suma, resta, división, etc. Es un modelo previo de un calculadora actual.


CODIGO_______________________________________________________________
'declaramos dos variables que serán donde se guardaran los datos ingresados por el usuario
Dim VAR1, VAR2 As Double
'declaramos un serie de variables que mostraran el resultado de cada operación correspondiente
Dim MULTI, SUMA, DIVI, RESTA, PRO, ENT, MODULO, POR As Double
Private Sub Command1_Click()
'boton sumar
VAR1 = Text1.Text
VAR2 = Text2.Text
SUMA = VAR1 + VAR2
Text3.Text = SUMA
End Sub
Private Sub Command10_Click()
'boton modulo
VAR1 = Text1.Text
VAR2 = Text2.Text
MODULO = VAR1 Mod VAR2
Text3.Text = MODULO
End Sub
Private Sub Command2_Click()
'boton multiplicar
VAR1 = Text1.Text
VAR2 = Text2.Text
MULTI = VAR1 * VAR2
Text3.Text = MULTI
End Sub
Private Sub Command3_Click()
'boton resta
VAR1 = Text1.Text
VAR2 = Text2.Text
RESTA = VAR1 - VAR2
Text3.Text = RESTA
End Sub
Private Sub Command4_Click()
'boton division
VAR1 = Text1.Text
VAR2 = Text2.Text
DIVI = VAR1 / VAR2
Text3.Text = DIVI
End Sub
Private Sub Command5_Click()
'boton multiplicación
VAR1 = Text1.Text
VAR2 = Text2.Text
PRO = (VAR1 + VAR2) / 2
Text3.Text = PRO
End Sub
Private Sub Command6_Click()
'boton salir
End
End Sub
Private Sub Command7_Click()
'boton borra
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command8_Click()
'boton porcentaje
VAR1 = Text1.Text
VAR2 = Text2.Text
POR = (VAR1 * VAR2) / 100
Text3.Text = POR
End Sub
Private Sub Command9_Click()
'botón división entera
VAR1 = Text1.Text
VAR2 = Text2.Text
ENT = VAR1 \ VAR2
Text3.Text = ENT
End Sub