Create A Calculator Program Similar To Windows Calculator (The Non-Scientific One) Using Control Array. Aim
Create A Calculator Program Similar To Windows Calculator (The Non-Scientific One) Using Control Array. Aim
____________________________________________________________________________
Page No: 7
Sikkim Manipal University
4. Create a calculator program similar to windows Calculator (the non-
scientific one) using control array.
Aim
The objective of this exercise is to understand the usage of control array and the multiple
functions to do the arithmetic operations.
Procedure
Step 1: Create a user interface similar to a calculator. Create Textbox control array.
Step 2: Write the codes for the below listed functions in the appropriate events
Addition
Subtraction
Division
Multiplication
Square Root
Exponents (Power Of)
Clear Entry
Clear All
When a user clicks a number button (in this case the number one button) we check the status of
the inputStatus(variable) flag. If its true then we know we can just append the next value to the
end of whats currently in the input box, otherwise we just enter the number into the input box
Private Sub cmd1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles cmd1.Click
Visual Programming Exercise No: 4
____________________________________________________________________________
Page No: 8
Sikkim Manipal University
Check the inputStatus
If inputStatus Then 'Its True Append values to the value 'in the input box
txtInput.Text += cmd1.Text
Else 'Value is False
'Set the value to the value of the button
txtInput.Text = cmd1.Text
'Toggle inputStatus to True
inputStatus = True
End If
End Sub
Step 3: Display the output.
Input: 10 * 10
Expected Output