VB Code:
Windows Form generated code
Dim strNumber As String
Dim decNum1 As Decimal
Dim decNum2 As Decimal
Dim chrOperator As Char
Dim decAnswer As Decimal
VB Code:
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click, btn1.Click, btn2.Click, btn3.Click, btn4.Click, btn5.Click, btn6.Click, btn7.Click, btn8.Click, btn9.Click, btndecimal.Click
strNumber = strNumber & sender.text
lblanswer.Text = strNumber
End Sub
VB Code:
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
If sender.text = "=" Then
decNum2 = strNumber
'work out your answer here and display it in the label.
'Put the answer into decnum1i think this is right?
Else
decNum1 = strNumber
chrOperator = sender.text
End If
strNumber = ""
End Sub
VB Code:
Private Sub btnequals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnequals.Click
If sender.text = "=" Then
lblanswer.Text = decAnswer
End If
End Sub
End Class
ok thats all the code i have i need to work out that middle bit in bold could anyone clear this up for me or give me the code to simple similar calculator program thank you for helping![]()





Reply With Quote