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 ' Compute and display the result intIn1 = CInt(txtIn1.Text) intIn2 = CInt(txtIn2.Text) intTotal = intIn1 + intIn2 lblOut.Text = CStr(intTotal) 'Display the result End SubThe first three lines declare three integer variables, intIn1, intIn2 and intTotal.
The next two lines assign the values the user enters to the variables the programmer has set aside for input values. (The user enters the values into TextBoxes called txtIn1 and txtIn2). Note that the CInt function converts the data type of the input from string to integer.
The final statements add the two numbers and assign the result to the Text property of the output label.
Note that the comments on the last statements are at the end of the line. Like comments that are on their own lines, these comments are only for the benefit of a person reading the program. They are ignored during execution.