Q1 write a window application which takes the input from user and perform the addition of two numbers.

In this program we have added two numbers using the user input. The form looks like as follows:

addition-two-number

Here we have used two labels for taking the value of a and b as message. Now we have to add the code on button click. Here is the code:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b As Integer
a = Convert.ToInt32(TextBox1.Text)
b = Convert.ToInt32(TextBox2.Text)
MessageBox.Show("Sum is : " & (a + b))

End Sub
End Class

Here we have to give the code on button click event. Here we have a and b variable of int type which holds the value which are coming from textbox and here we have also performed the type conversion then the value assigned means textBox1.Text value will be hold by the a and textBox2.Text value will be hold by the b. after that we have added both and display it using the dialog. The output is as follows:

addition-two-number