Click here to Skip to main content
15,887,683 members
Articles / Programming Languages / Visual Basic

A multipurpose scientific calculator

Rate me:
Please Sign up or sign in to vote.
2.56/5 (36 votes)
17 Apr 2008CPOL5 min read 188.6K   14.2K   50  
A calculator handling complex numbers and scientific functions
��Public Class trign

    Private Sub trign_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click

        Me.inv.Checked = False

        calculator.Select()

    End Sub

    Public Sub trign_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.BackColor = calculator.BackColor

        Me.Location = New System.Drawing.Point(calculator.Right, calculator.Bottom - Me.Height - calculator.memoryfrm.Height)

        Me.Owner = calculator

    End Sub

    Private Sub trigbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sin.Click, cos.Click, tan.Click, sinh.Click, cosh.Click, tanh.Click

        calculator.Select()

        If Not calculator.s = 0 Then

            calculator.s = 0

            calculator.expression.Clear()

            calculator.expression.Select()

        End If

        calculator.expression.Paste(sender.text)

        If Me.inv.Checked Then

            calculator.expression.Paste("��")

            Me.inv.Checked = False

        End If

    End Sub

    Private Sub inv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles inv.Click

        calculator.Select()

    End Sub

    Private Sub trign_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

        Me.Location = New System.Drawing.Point(calculator.Right, calculator.Bottom - Me.Height - calculator.memoryfrm.Height)

    End Sub

    Private Sub sel(ByVal sender As Object, ByVal e As System.EventArgs) Handles cos.Click, cosh.Click, inv.Click, Me.Click, sin.Click, sinh.Click, tan.Click, tanh.Click

        If calculator.s = 0 Then

            calculator.expression.Select()

        End If

        calculator.comment.Text = ""

    End Sub

    Private Sub trign_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown

        calculator.Select()

    End Sub

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Yahoo!
India India
I've studied info. sc. engg. from Sir MVIT, Bangalore.

I'm interested in programming.

Some of my technical blogs:

http://perl-blog.kbsbng.com/
http://java-blog.kbsbng.com/

I also enjoy writing some webpages such as http://sites.google.com/site/plantencyclopedia/

More about me at http://www.kbsbng.com and http://blog.kbsbng.com.

Comments and Discussions