Eres el visitante Nº

contador de visitas

lunes, 4 de junio de 2012

Calculadora creada por nosotros en VISUAL BASIC 2010



Public Class Calculadora

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles multiplicar.Click


        If txtnumero1.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub
        End If

        If Txtnumero2.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub

        End If

        Dim numero1 As Double
        numero1 = Convert.ToDouble(txtnumero1.Text)
        Dim numero2 As Double
        numero2 = Convert.ToDouble(Txtnumero2.Text)
        Dim total As Double
        total = numero1 * numero2
        Txttotal.Text = total

    End Sub

    Private Sub sumar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sumar.Click

        If txtnumero1.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub
        End If

        If Txtnumero2.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub

        End If

        Dim numero1 As Double
        numero1 = Convert.ToDouble(txtnumero1.Text)
        Dim numero2 As Double
        numero2 = Convert.ToDouble(Txtnumero2.Text)
        Dim total As Double
        total = numero1 + numero2
        Txttotal.Text = total
    End Sub

    Private Sub limpiar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles limpiar.Click
        If txtnumero1.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub
        End If

        If Txtnumero2.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub

        End If
        txtnumero1.Text = vbNullString
        Txtnumero2.Text = vbNullString
        Txttotal.Text = vbNullString



    End Sub

    Private Sub restar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles restar.Click

        If txtnumero1.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub
        End If

        If Txtnumero2.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub

        End If

        Dim numero1 As Double
        numero1 = Convert.ToDouble(txtnumero1.Text)
        Dim numero2 As Double
        numero2 = Convert.ToDouble(Txtnumero2.Text)
        Dim total As Double
        total = numero1 - numero2
        Txttotal.Text = total
    End Sub

    Private Sub dividir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dividir.Click

        If txtnumero1.Text = vbNullString Then
            MsgBox("Debe ingresar valores  ", vbCritical)
            Exit Sub
        End If

        If Txtnumero2.Text = vbNullString Then
            MsgBox("Debe ingresar valores", vbCritical)
            Exit Sub

        End If

        Dim numero1 As Double
        numero1 = Convert.ToDouble(txtnumero1.Text)
        Dim numero2 As Double
        numero2 = Convert.ToDouble(Txtnumero2.Text)
        Dim total As Double
        total = numero1 / numero2
        Txttotal.Text = total
    End Sub

    Private Sub salir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles salir.Click
        MsgBox("Gracias por usar la calculadora")
        Me.Dispose()
    End Sub

    Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click
        MsgBox("Gracias por usar la calculadora")
        Me.Dispose()
    End Sub

    Private Sub AcercaDeLaCalculadoraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcercaDeLaCalculadoraToolStripMenuItem.Click
        MsgBox("Calculadora creada por: Edward Matias Morales Viera" + vbCrLf & "Por más informacion: Sitio Web:www.servicerepair.uphero.com", vbInformation)
    End Sub


   
    Private Sub CopiarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopiarToolStripMenuItem.Click
        txtnumero1.Copy()
        Txtnumero2.Copy()
        Txttotal.Cut()
    End Sub

    Private Sub CortarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CortarToolStripMenuItem.Click
        txtnumero1.Cut()
        Txtnumero2.Cut()
        Txttotal.Cut()
    End Sub

    Private Sub PegarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PegarToolStripMenuItem.Click
        txtnumero1.Paste()
        Txtnumero2.Paste()
        Txttotal.Paste()
    End Sub

    Private Sub DesacherToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DesacherToolStripMenuItem.Click
        txtnumero1.Undo()
        Txtnumero2.Undo()
        Txttotal.Undo()
    End Sub


End Class

No hay comentarios:

Publicar un comentario