127k views
16 votes
Design a form and write a program in visual basic to input 2 integer number using text boxes. Also calculate product of 2 integer number​

1 Answer

11 votes

Answer:

The program is as follows:

Dim num1 As Integer

Dim num2 As Integer

Dim product As Integer

num1 = Val(txtNum1.Text)

num2 = Val(txtNum2.Text)

product = num1 * num2

txtResult.Text = product.ToString()

See attachment for program interface

Step-by-step explanation:

First, add 3 labels to the form

Set the following properties:

Label 1:

Name: lblNum1

Text: Number 1

Label 2:

Name: lblNum2

Text: Number 2

Label 3:

Name: lblProduct

Text: Product

Next, add 3 textboxes to the form

Set the following properties:

Textbox 1:

Name: txtNum1

Textbox 2:

Name: txtNum2

Textbox 3:

Name: txtProduct

Lastly, add a button to the form and set the following property

Button:

Name: btnCalc

Text: Calculate

Double-click on the button on the form to open the code area, then add the following lines of code

Dim num1 As Integer

Dim num2 As Integer

Dim product As Integer

num1 = Val(txtNum1.Text)

num2 = Val(txtNum2.Text)

product = num1 * num2

txtResult.Text = product.ToString()

Design a form and write a program in visual basic to input 2 integer number using-example-1
User GarySabo
by
3.0k points