Nombre: calculadora
Descripción:
codigo de una calculadora en VisualStudio.NET
URL: http://www.mygnet.net/codigos/vbdotnet/net/calculadora.2139
Código Fuente:
Dim m As Integer
Dim s As Integer
Dim r As Integer
Dim x As Integer
Dim d As Integer
Dim op As Integer
Botones de 0-9
Botones
Tb1.Text = Tb1.Text + Bt1.Text
Botones
Tb1.Text = Tb1.Text + Bt2Text
Botones
Tb1.Text = Tb1.Text + Bt3Text
Botones
Tb1.Text = Tb1.Text + Bt6Text
Botones
Tb1.Text = Tb1.Text + Bt7Text
Botones
Tb1.Text = Tb1.Text + Bt8Text
Botones
Tb1.Text = Tb1.Text + Bt11Text
Botones
Tb1.Text = Tb1.Text + Bt12Text
Botones
Tb1.Text = Tb1.Text + Bt13Text
Botones
Tb1.Text = Tb1.Text + Bt16Text
Botones
Tb1.Text = Tb1.Text + Bt17Text
Boton suma
s = Tb1.Text
op = 1
Tb1.Clear()
Boton resta
r = Tb1.Text
op = 2
Tb1.Clear()
Botón multiplicación
x = Tb1.Text
op = 3
Tb1.Clear()
Boton division
d = Tb1.Text
op = 4
Tb1.Clear()
Boton igual
Se hacen todas las operaciones
If op = 1 Then
Tb1.Text = Int(Tb1.Text) + s
End If
If op = 2 Then
Tb1.Text = r - Int(Tb1.Text)
End If
If op = 3 Then
Tb1.Text = Int(Tb1.Text) * x
End If
If op = 4 Then
Tb1.Text = d / Int(Tb1.Text)
End If
End Sub
Boton AC
Tb1.Text = "0"
Tb1.Clear()
End Sub
Boton M+
m = Tb1.Text
Tb1.Clear()
Código generado
Boton MR
Tb1.Text = m