Public Class Form1
Dim b As Integer
Dim c As Integer
Dim num1 As Double
Dim num2 As Double
Dim resul As Integer
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles B1.Click
Tpantalla.Text = Tpantalla.Text & "1"
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Bsuma.Click
b = 1
num1 = Tpantalla.Text
Tpantalla.Text = ""
End Sub
Private Sub B0_Click(sender As Object, e As EventArgs) Handles B0.Click
Tpantalla.Text = Tpantalla.Text & "0"
End Sub
Private Sub B2_Click(sender As Object, e As EventArgs) Handles B2.Click
Tpantalla.Text = Tpantalla.Text & "2"
End Sub
Private Sub B3_Click(sender As Object, e As EventArgs) Handles B3.Click
Tpantalla.Text = Tpantalla.Text & "3"
End Sub
Private Sub B4_Click(sender As Object, e As EventArgs) Handles B4.Click
Tpantalla.Text = Tpantalla.Text & "4"
End Sub
Private Sub B5_Click(sender As Object, e As EventArgs) Handles B5.Click
Tpantalla.Text = Tpantalla.Text & "5"
End Sub
Private Sub B6_Click(sender As Object, e As EventArgs) Handles B6.Click
Tpantalla.Text = Tpantalla.Text & "6"
End Sub
Private Sub B7_Click(sender As Object, e As EventArgs) Handles B7.Click
Tpantalla.Text = Tpantalla.Text & "7"
End Sub
Private Sub B8_Click(sender As Object, e As EventArgs) Handles B8.Click
Tpantalla.Text = Tpantalla.Text & "8"
End Sub
Private Sub B9_Click(sender As Object, e As EventArgs) Handles B9.Click
Tpantalla.Text = Tpantalla.Text & "9"
End Sub
Private Sub Bigual_Click(sender As Object, e As EventArgs) Handles Bigual.Click
num2 = Tpantalla.Text
If b = 1 Then
Tpantalla.Text = num1 + num2
End If
If b = 2 Then
Tpantalla.Text = num1 - num2
End If
If b = 3 Then
Tpantalla.Text = num1 * num2
End If
If b = 4 Then
If num2 <> 0 Then
Tpantalla.Text = num1 / num2
Else
Tpantalla.Text = "No divisible"
End If
End If
If b = 5 Then
Tpantalla.Text = num1 ^ num2
End If
End Sub
Private Sub Bresta_Click(sender As Object, e As EventArgs) Handles Bresta.Click
b = 2
Bcoma.Enabled = True
num1 = Tpantalla.Text
Tpantalla.Text = ""
End Sub
Private Sub Bmulti_Click(sender As Object, e As EventArgs) Handles Bmulti.Click
b = 3
Bcoma.Enabled = True
num1 = Tpantalla.Text
Tpantalla.Text = ""
End Sub
Private Sub Bdivi_Click(sender As Object, e As EventArgs) Handles Bdivi.Click
b = 4
Bcoma.Enabled = True
num1 = Tpantalla.Text
Tpantalla.Text = ""
End Sub
Private Sub Blim_Click(sender As Object, e As EventArgs) Handles Blim.Click
Tpantalla.Text = ""
Bcoma.Enabled = True
End Sub
Private Sub Bcoma_Click(sender As Object, e As EventArgs) Handles Bcoma.Click
Tpantalla.Text = Tpantalla.Text & ","
Bcoma.Enabled = False
End Sub
Private Sub Tpantalla_TextChanged(sender As Object, e As EventArgs) Handles Tpantalla.TextChanged
End Sub
Private Sub Buno_Click(sender As Object, e As EventArgs) Handles Buno.Click
Try
Dim lar As Integer
If Tpantalla.Text <> "" Then
lar = Tpantalla.Text.Length
Tpantalla.Text = Mid(Tpantalla.Text, 1, lar - 1)
End If
Catch ex As Exception
End Try
End Sub
Private Sub Bx_Click(sender As Object, e As EventArgs) Handles Bx.Click
b = 5
num1 = Tpantalla.Text
Tpantalla.Text = ""
If b = 5 Then
Tpantalla.Text = num1 ^ 2
End If
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
b = 5
num1 = Tpantalla.Text
Tpantalla.Text = ""
End Sub
Private Sub Braiz_Click(sender As Object, e As EventArgs) Handles Braiz.Click
b = 7
num1 = Tpantalla.Text
Tpantalla.Text = ""
If b = 7 Then
Tpantalla.Text = Math.Sqrt(num1)
End If
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
b = 8
num2 = Tpantalla.Text
Tpantalla.Text = ""
If b = 8 Then
Tpantalla.Text = 1 / num2
End If
End Sub
Private Sub Bmm_Click(sender As Object, e As EventArgs) Handles Bmm.Click
b = 9
num1 = Tpantalla.Text
Tpantalla.Text = ""
If b = 9 Then
Tpantalla.Text = num1 * (-1)
End If
End Sub
Private Sub Bfac_Click(sender As Object, e As EventArgs) Handles Bfac.Click
Dim a, b, c As Integer
a = (Tpantalla.Text)
b = 1
For c = 1 To a
b = b * c
Tpantalla.Text = (b)
Next
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs)
End Sub
Private Sub Bsen_Click(sender As Object, e As EventArgs) Handles Bsen.Click
b = 10
num1 = Tpantalla.Text
Tpantalla.Text = ""
If b = 10 Then
Tpantalla.Text = Math.Sin(Val(num1) * Math.PI / 180)
End If
End Sub
Private Sub Bcos_Click(sender As Object, e As EventArgs) Handles Bcos.Click
b = 11
num1 = Tpantalla.Text
Tpantalla.Text = ""
If b = 11 Then
Tpantalla.Text = Math.Cos(Val(num1) * Math.PI / 180)
End If
End Sub
Private Sub Btan_Click(sender As Object, e As EventArgs) Handles Btan.Click
b = 12
num1 = Tpantalla.Text
Tpantalla.Text = ""
If b = 12 Then
Tpantalla.Text = Math.Tan(Val(num1) * Math.PI / 180)
End If
End Sub
Private Sub Bmem_Click(sender As Object, e As EventArgs) Handles Bmem.Click
End Sub
End Class