Calculadora Ver2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

FUNCIONES MATEMIATICAS

CALCULADORA Ver. 2.0

Public Class Form1


Dim N As Integer
Dim OP As Char

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
TextBox1.Text = TextBox1.Text + "1"
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
TextBox1.Text = TextBox1.Text + "2"
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
TextBox1.Text = TextBox1.Text + "3"
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button6.Click
TextBox1.Text = TextBox1.Text + "4"
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button5.Click
TextBox1.Text = TextBox1.Text + "5"
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
TextBox1.Text = TextBox1.Text + "6"
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button9.Click
TextBox1.Text = TextBox1.Text + "7"
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button8.Click
TextBox1.Text = TextBox1.Text + "8"
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button7.Click
TextBox1.Text = TextBox1.Text + "9"
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button11.Click
TextBox1.Text = TextBox1.Text + "0"
End Sub

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button14.Click
LIMPIAR()
End Sub

Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button13.Click
N = Val(TextBox1.Text)
LIMPIAR()
OP = "+"
End Sub

Sub LIMPIAR()
TextBox1.Clear()
TextBox1.Focus()
End Sub
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button17.Click
Select Case OP
Case "+"
TextBox1.Text = N + Val(TextBox1.Text)
Case "-"
TextBox1.Text = N - Val(TextBox1.Text)
Case "*"
TextBox1.Text = N * Val(TextBox1.Text)
Case "/"
TextBox1.Text = N / Val(TextBox1.Text)
End Select

End Sub

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button16.Click
N = Val(TextBox1.Text)
LIMPIAR()
OP = "-"
End Sub

Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button18.Click
N = Val(TextBox1.Text)
LIMPIAR()
OP = "*"
End Sub

Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button20.Click
N = Val(TextBox1.Text)
LIMPIAR()
OP = "/"
End Sub

Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button15.Click
Dim f As Double
Dim x, a As Integer
f=1
a = Val(TextBox1.Text)
For x = 1 To a
f=f*x
Next
TextBox1.Text = f

End Sub
Ing. Dunkans

You might also like