1. Visual Basic Programming [Lesson 1 & Lesson 2]
1 of 1
Assignment for Variables
Author: Kasun Ranga Wijeweera
Email: krw19870829@gmail.com
Date: 2020 April 28
1)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a text box to the form.
c) Add a button to the form and program it according to the steps given below.
d) Declare two integer variables with names num1 and num2 respectively.
e) Initialize the two variables declared in (1) (d) above with values 14 and 57 respectively.
f) Declare another integer variable with name sum.
g) Store the sum of the values of the variables num1 and num2 in the variable sum.
h) Display the value of the variable sum in a message box.
i) Modify the code such that the value of the variable sum appears in the text box instead of
the message box.
2)
a) Start a new Visual Basic Windows Forms Application project.
b) Add three text boxes to the form and label them as “First Name”, “Middle Name”, and
“Last Name” respectively.
c) Add a button to the form and program it according to the steps given below.
d) Declare three string variables and assign the input of each text box in (2) (b) above to
each variable.
e) Declare another string variable to store the full name.
f) Compute the full name by concatenating the values of the three variables in (2) (d) above
and store it in the variable created in (2) (e) above.
g) Display the full name in a message box.
3)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a text box to the form.
c) Add a button to the form and program it according to the steps given below.
d) Declare an integer variable.
e) The user is expected to enter an integer in the text box.
f) Assign the input of the text box in (3) (b) above to the variable in (3) (d) above.
g) Multiply the integer by 10 and display the result on the button.