Wednesday, 29 April 2015

Design a Simple Calculator using Visual Basic Language.


  •  Design a user interface as following:




  • Programs:


Public Class frmSimpleCalculator

    Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
        Dim a, b, c As Double
        a = txtNum1.Text
        b = txtNum2.Text
        c = a + b
        txtOutput.Text = a & "+" & b & "=" & c
    End Sub

    Private Sub btnSubs_Click(sender As Object, e As EventArgs) Handles btnSubs.Click
        Dim a, b, c As Double
        a = txtNum1.Text
        b = txtNum2.Text
        c = a - b
        txtOutput.Text = a & "-" & b & "=" & c
    End Sub

    Private Sub btnMul_Click(sender As Object, e As EventArgs) Handles btnMul.Click
        Dim a, b, c As Double
        a = txtNum1.Text
        b = txtNum2.Text
        c = a * b
        txtOutput.Text = a & "x" & b & "=" & c
    End Sub

    Private Sub btnDiv_Click(sender As Object, e As EventArgs) Handles btnDiv.Click
        Dim a, b, c As Double
        a = txtNum1.Text
        b = txtNum2.Text
        c = a / b
        txtOutput.Text = a & "/" & b & "=" & c
    End Sub
End Class

1 comment:

  1. Thank you blog administrator for sharing wonderful information on these blog. I really appreciate your hard work.
    Software Development Company in Indore

    ReplyDelete