Formulas Para Calculadora En Visual Basic
Dim OP As String
Dim a, b, resultado As Double
Dim c As Double
Numeros:
1:
If c = True Then
Text1.Text = ""
End If
Text1.Text = Text1.Text + "1"c = False
2:
If c = True Then
Text1.Text = ""
End If
Text1.Text = Text1.Text + "2"
c = False
3:
If c = True Then
Text1.Text = ""
End If
Text1.Text =Text1.Text + "3"
c = False
4:
If c = True Then
Text1.Text = ""
End If
Text1.Text = Text1.Text + "4"
c = False
5:
If c = True Then
Text1.Text = ""
End IfText1.Text = Text1.Text + "5"
c = False
6:
If c = True Then
Text1.Text = ""
End If
Text1.Text = Text1.Text + "6"
c = False
7:
If c = True Then
Text1.Text = ""
EndIf
Text1.Text = Text1.Text + "7"
c = False
8:
If c = True Then
Text1.Text = ""
End If
Text1.Text = Text1.Text + "8"
c = False
9:
If c = True Then
Text1.Text= ""
End If
Text1.Text = Text1.Text + "9"
c = False
0:
If c = True Then
Text1.Text = ""
End If
Text1.Text = Text1.Text + "0"
c = False
FORMULAS DE LOSOPERADORES:
Suma:
a = Text1.Text
Text1.Text = ""
OP = "SUMA"
Resta:
a = Text1.Text
Text1.Text = ""
OP = "RESTA"
Multiplicación:
a = Text1.Text
Text1.Text = ""OP = "MULTIPLICACION"
DIVISION:
a = Text1.Text
Text1.Text = ""
OP = "DIVISION"
FORMULA IGUAL:
b = Val(Text1.Text)
Select Case OP
Case "SUMA"
resultado = a + bText1.Text = resultado
Case "RESTA"
resultado = a - b
Text1.Text = resultado
Case "MULTIPLICACION"
resultado = a * b
Text1.Text = resultado
Case "DIVISION"resultado = a / b
Text1.Text = resultado
End Select
FORMULA PUNTO :
Text1.Text = Text1.Text + "."
FORMULA DE BORRAR CE
Text1.Text = ""
FORMULA DE OFF:
END
Regístrate para leer el documento completo.