0% found this document useful (0 votes)
77 views2 pages

Create A Calculator Program Similar To Windows Calculator (The Non-Scientific One) Using Control Array. Aim

The document describes creating a calculator program using control array that functions similarly to the basic Windows calculator. It involves: 1. Creating a user interface with textbox control array to display input and output. 2. Writing code for arithmetic functions like addition, subtraction, etc. and other functions like clear entry, clear all. 3. When number buttons are clicked, the code checks a variable to determine if the number should be appended to existing input or replace it, and updates the input textbox accordingly.

Uploaded by

Ajit Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views2 pages

Create A Calculator Program Similar To Windows Calculator (The Non-Scientific One) Using Control Array. Aim

The document describes creating a calculator program using control array that functions similarly to the basic Windows calculator. It involves: 1. Creating a user interface with textbox control array to display input and output. 2. Writing code for arithmetic functions like addition, subtraction, etc. and other functions like clear entry, clear all. 3. When number buttons are clicked, the code checks a variable to determine if the number should be appended to existing input or replace it, and updates the input textbox accordingly.

Uploaded by

Ajit Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Visual Programming Exercise No: 4

____________________________________________________________________________
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

You might also like