First, read and study our notes on Numeric expressions using constants, Numeric expressions using variables , and User input with numeric variables.
The event handler for our program for adding two numbers was 9 lines long:
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click ' Declare the variables Dim intIn1 As Integer Dim intIn2 As Integer Dim intTotal As Integer ' Assign user input to variables intIn1 = CInt(txtIn1.Text) intIn2 = CInt(txtIn2.Text) intTotal = intIn1 + intIn2 'Calculate the total lblOut.Text = CStr(intTotal) 'Display the result End Sub
There are many ways to write a program that does a given task. Your assignment is to write a new version of the event handler so that it uses the Text properties of txtIn1 and txtIn2 instead of variables.
Print the new event handler and turn it in along with a screen shot of your program adding 131.7 and 421.2 and explain why the program got the answer it did.