Visual Basic: The following pseudocode algorithm for the event handler btnCalcAr
ID: 3672569 • Letter: V
Question
Visual Basic: The following pseudocode algorithm for the event handler btnCalcArea_Click has
an error. The event handler is supposed to calculate the area of a room’s floor. The
area is calculated as the room’s width (entered by the user into txtWidth ), multi-
plied by the room’s length (entered by the user into in txtLength ). The result is dis-
played with the label lblArea . Find the error and correct the algorithm.
a. Multiply the intWidth variable by the intLength variable and store the result
in the intArea variable.
b. Assign the value in txtWidth.Text to the intWidth variable.
c. Assign the value in txtLength.Text to the intLength variable.
d. Assign the value in the intArea variable to lblArea.Text
Explanation / Answer
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox3.Text = TextBox1.Text * TextBox2.Text
End Sub
End Class
Here TextBox3. Text contains the result of TextBox1.Text (it contains width) multiply with TextBox2.Text(it contains height)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.