Hi,
My code is pretty much complete.
I just need help in 2 things
1) When the program runs the 0 appears, which is fine, but when I type/write a number the Zero would continue next to the number i type/write
2) When i make an operation, such as add/divide/multiplication continuously.
For instance: if i type 1 + 2 and = it will give me 3. However, if i take that 3 and multiply it or divide it at the same time with another operation, the result doesn't appear. the operation gets done, but i cant see the previous answer in the process
PLEASE HELP ME AS SOON AS POSSIBLE
THANK YOU
Public Class frmMain
'Declare the global variables to be used throughout the form
Dim mfirst As Single
Dim msecond As Single
Dim manswer As Single
' Declare the global variables for the operators: Add,Sub,Mul and DIV
Dim mbutton As Integer
'Change the sign of the number from + or - or vice versa
' Depending on its state now they show in txtNUMBER text box
Dim Signstate As Boolean
Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Put the value 0 into the txtDisplay text box
txtDisplay.Text = txtDisplay.Text & "0"
End Sub
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
'Put the value 1 into the txtDisplay text box
txtDisplay.Text = txtDisplay.Text & "1"
End Sub
Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
'Put the value 2 into the txtDisplay text box
txtDisplay.Text = txtDisplay.Text & "2"
End Sub
Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
'Put the value 3 into the txtDisplay text box
txtDisplay.Text = txtDisplay.Text & "3"
End Sub
Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
'Put the value 4 into the txtDisplay text box
txtDisplay.Text = txtDisplay.Text & "4"
End Sub
Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click
'Put the value 5 into the txtDisplay text box
txtDisplay.Text = txtDisplay.Text & "5"
End Sub
Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
txtDisplay.Text = txtDisplay.Text & "6"
End Sub
Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
txtDisplay.Text = txtDisplay.Text & "7"
End Sub
Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
txtDisplay.Text = txtDisplay.Text & "8"
End Sub
Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
txtDisplay.Text = txtDisplay.Text & "9"
End Sub
Private Sub btnDot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDot.Click
txtDisplay.Text = txtDisplay.Text & "."
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
'User slected the add button
mbutton = 1
'Convert into a number and transfer the value from
'The text box on the form into the first number
mfirst = Val(txtDisplay.Text)
txtDisplay.Text = ""
End Sub
Private Sub btnSubstract_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubstract.Click
'User slected the minus button
mbutton = 2
'Convert into a number and transfer the value from
'The text box on the form into the first number
mfirst = Val(txtDisplay.Text)
txtDisplay.Text = ""
End Sub
Private Sub btnMultiply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMultiply.Click
'User slected the multiply button
mbutton = 3
'Convert into a number and transfer the value from
'The text box on the form into the first number
mfirst = Val(txtDisplay.Text)
txtDisplay.Text = ""
End Sub
Private Sub btnDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDivide.Click
'User slected the Divide button
mbutton = 4
'Convert into a number and transfer the value from
'The text box on the form into the first number
mfirst = Val(txtDisplay.Text)
txtDisplay.Text = ""
End Sub
Private Sub btnEquals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEquals.Click
msecond = Val(txtDisplay.Text)
Select Case mbutton
Case Is = 1
manswer = mfirst + msecond
Case Is = 2
manswer = mfirst - msecond
Case Is = 3
manswer = mfirst * msecond
Case Is = 4
manswer = mfirst / msecond
End Select
txtDisplay.Text = manswer
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
mbutton = 0
txtDisplay.Text = "0"
End Sub
End Class