Criar uma Loja Virtual Grátis
Translate to English Translate to Spanish Translate to French Translate to German Google-Translate-Portuguese to Italian Translate to Russian Translate to Chinese Translate to Japanese

Rating: 2.8/5 (92 votos)



ONLINE
1





Partilhe esta Página





Total de visitas: 5645
Calculadora básica igual a do Windows
Calculadora básica igual a do Windows

Calculadora

Código fonte

Public Class Form1

    Dim valor As Decimal

    Dim sinal As Integer

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMais.Click

        sinal = "1"

        valor = TextBox1.Text

        TextBox1.Text = ""

    End Sub

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

    End Sub

 

    Private Sub BtnZero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn0.Click

        TextBox1.Text = TextBox1.Text & "0"

    End Sub

 

    Private Sub Btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn1.Click

        TextBox1.Text = TextBox1.Text & "1"

    End Sub

 

    Private Sub Btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn2.Click

        TextBox1.Text = TextBox1.Text & "2"

    End Sub

 

    Private Sub Btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn3.Click

        TextBox1.Text = TextBox1.Text & "3"

    End Sub

 

    Private Sub Btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn4.Click

        TextBox1.Text = TextBox1.Text & "4"

    End Sub

 

    Private Sub Btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn5.Click

        TextBox1.Text = TextBox1.Text & "5"

    End Sub

 

    Private Sub Btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn6.Click

        TextBox1.Text = TextBox1.Text & "6"

    End Sub

 

    Private Sub Btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn7.Click

        TextBox1.Text = TextBox1.Text & "7"

    End Sub

 

    Private Sub Btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn8.Click

        TextBox1.Text = TextBox1.Text & "8"

    End Sub

 

    Private Sub Btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn9.Click

        TextBox1.Text = TextBox1.Text & "9"

    End Sub

 

    Private Sub BtnSub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSub.Click

        valor = TextBox1.Text

        sinal = "2"

        TextBox1.Text = ""

    End Sub

 

    Private Sub BtnMult_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMult.Click

        valor = TextBox1.Text

        sinal = "3"

        TextBox1.Text = ""

    End Sub

 

    Private Sub BtnDiv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDiv.Click

        valor = TextBox1.Text

        sinal = "4"

        TextBox1.Text = ""

 

    End Sub

 

    Private Sub BtnIgual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnIgual.Click

        If sinal = "1" Then

            TextBox1.Text = valor + TextBox1.Text

        End If

        If sinal = "2" Then

            TextBox1.Text = valor - TextBox1.Text

        End If

        If sinal = "3" Then

            TextBox1.Text = valor * TextBox1.Text

        End If

        If sinal = "4" Then

            TextBox1.Text = valor / TextBox1.Text

        End If

 

    End Sub

 

    Private Sub BtnC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnC.Click

        TextBox1.Text = ""

    End Sub

 

    'Private Sub BtnRaiz_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    '    If TextBox1.Text.Length <> 0 Then

    '        If TextBox1.Text <> "." Then

    '            TextBox1.Text = Math.Sqrt(TextBox1.Text)

    '        End If

    '    End If

    'End Sub

    Private Sub Btnvirgula_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnvirgula.Click

        TextBox1.Text = TextBox1.Text & ","

    End Sub

End Class

 

Baixar