Hey guys! Its been a loooong while that I didn't come with any mess here :D

I'm making a calculator app for a friend, and I want to make it the more complete that I can.

I'm putting into it the basics: addition, subtraction, divison and multiplication. Also, I'm using square root, square numbers and percentage. And also sin, cos, tg, cossec, sec and tan.

But some functions that are on the standard windows calc I don't know how to do (yet :P)

It has these buttons: "← CE C ±".

The first one deletes the last typed char. How can I do it?
The CE deletes the last operation. Like, if I type 2 + 2 + 4 + 8 and then hit CE, it will clear everything until the first '+'. I think that I can do it with a redundant variable. what do you think?
C clears everything. easy to do.
And ± inverts the value signal. No clue o here.

Some help, guys? And sorry if I mispelled some math words, I'm brazilian :P


To delete the last typed char you need this:

Private Sub btnBackSpace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBackSpace.Click

        If (lblDisplay.Text.Length > 0) Then
            d = lblDisplay.Text.Length
            lblDisplay.Text = lblDisplay.Text.Remove(d - 1, 1)

        End If

    End Sub

To change the value signal, you need this:

Private Sub bttnNegate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttnNegate.Click
        lblDisplay.Text = -CSng(lblDisplay.Text)
        ClearDisplay = True
    End Sub