0% found this document useful (0 votes)
25 views

Analice El Siguiente Codigo en Visual Basic y Cree La Pagina Correspondiente para Generar El Resultado Que Se Espera, Una Calculadora

This document contains Visual Basic code to create a calculator webpage. It includes code for number buttons, operation buttons like add, subtract, multiply and divide, and clear buttons. When a number button is clicked, that number is displayed. When an operation button is clicked, the first entered number is stored, the display cleared, and the operation is set. The equals button performs the calculation and displays the result.

Uploaded by

cyberomega2014
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Analice El Siguiente Codigo en Visual Basic y Cree La Pagina Correspondiente para Generar El Resultado Que Se Espera, Una Calculadora

This document contains Visual Basic code to create a calculator webpage. It includes code for number buttons, operation buttons like add, subtract, multiply and divide, and clear buttons. When a number button is clicked, that number is displayed. When an operation button is clicked, the first entered number is stored, the display cleared, and the operation is set. The equals button performs the calculation and displays the result.

Uploaded by

cyberomega2014
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Analice el siguiente codigo en Visual Basic y cree la pagina correspondiente para generar

el resultado que se espera, una calculadora.

Partial Class _Default

Inherits System.Web.UI.Page

Dim Dato As Double

Dim Dato1 As Double

Dim Result As Double

Dim Operacion As String

Dim P As String

Protected Sub n0_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n0.Click

Pantalla.Text = Pantalla.Text & "0"

End Sub

Protected Sub n1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n1.Click

Pantalla.Text = Pantalla.Text & "1"

End Sub

Protected Sub n2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n2.Click

Pantalla.Text = Pantalla.Text & "2"

End Sub

Protected Sub n3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n3.Click

Pantalla.Text = Pantalla.Text & "3"

End Sub
Protected Sub n4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n4.Click

Pantalla.Text = Pantalla.Text & "4"

End Sub

Protected Sub n5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n5.Click

Pantalla.Text = Pantalla.Text & "5"

End Sub

Protected Sub n6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n6.Click

Pantalla.Text = Pantalla.Text & "6"

End Sub

Protected Sub n7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n7.Click

Pantalla.Text = Pantalla.Text & "7"

End Sub

Protected Sub n8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n8.Click

Pantalla.Text = Pantalla.Text & "8"

End Sub

Protected Sub n9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n9.Click

Pantalla.Text = Pantalla.Text & "9"

End Sub
Protected Sub coma_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
coma.Click

Pantalla.Text = Pantalla.Text & "."

P=1

If P = 1 Then

coma.Enabled = False

End If

End Sub

Protected Sub suma_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


suma.Click

Operacion = "suma"

Dato = Val(Pantalla.Text)

Pantalla.Text = ""

coma.Enabled = True

End Sub

Protected Sub Igual_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


BT3.Click

Dato1 = Val(Pantalla.Text)

coma.Enabled = True

If Operacion = "suma" Then

Result = Dato + Dato1

Pantalla.Text = Result

Else
If Operacion = "resta" Then

Result = Dato - Dato1

Pantalla.Text = Result

Else

If Operacion = "multiplicacion" Then

Result = Dato * Dato1

Pantalla.Text = Result

Else

If Operacion = "division" Then

Result = Dato / Dato1

Pantalla.Text = Result

End If

End If

End If

End If

End Sub

Protected Sub resta_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


resta.Click

Operacion = "resta"

Dato = Val(Pantalla.Text)

Pantalla.Text = ""

coma.Enabled = True

End Sub
Protected Sub multiplicacion_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles multiplicacion.Click

Operacion = "multiplicacion"

Dato = Val(Pantalla.Text)

Pantalla.Text = ""

coma.Enabled = True

End Sub

Protected Sub division_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


division.Click

Operacion = "division"

Dato = Val(Pantalla.Text)

Pantalla.Text = ""

coma.Enabled = True

End Sub

Protected Sub CE_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CE.Click

Pantalla.Text = ""

coma.Enabled = True

End Sub

Protected Sub C_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles C.Click

Pantalla.Text = ""

coma.Enabled = True

End Sub

End Class

You might also like