Developing Application - Exercise Handout
Developing Application - Exercise Handout
12. Enter the following code to use and calculate these variables along with event handler so if the
user enters the string in text box so than the program should give feedback to user about the
mistake:
Private Sub btnAdd_Click(sender As System.Object, e As System.EventArgs) Handles
btnAdd.Click
On Error GoTo error_handler
operand1 = TextBox1.Text
operand2 = TextBox2.Text
result = operand1 + operand2
lblResult.Text = result
Exit Sub
error_handler:
13. Copy past the whole code mentioned in step 11 for every subroutine(Add+, Subtract-, Multiply
X, Divide /, Exponent ^) by double clicking on the buttons and do a minor change in result
variable depending on the operator
result = operand1 - operand2
result = operand1 * operand2
result = operand1 / operand2
result = operand1 ^ operand2
14. Add the following code to Clear button to make a clear function as a traditional calculator has:
lblErrMsg.Text = " "
lblResult.Text = "Result"
TextBox1.Text = 0
TextBox2.Text = 0
15. Run the program and test every aspect to make sure the functionality of the calculator.
16. Copy paste the script of the program in a word document and also take the screenshot of the
executed form and paste it in the word document.
17. Take a printout of word document and file it in your student activity file also save the word
document with your name in the class folder.