Identify the error in the following code:
Private Sub btnCalculate_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalculate.Click
' Declare some variables
Dim sngNumber1 As Single
Dim sngNumber2 As Single
Dim sngSum As Single
' Get the two numbers
SngNumber1 = txtNumber1.Text
SngNumber2 = txtNumber2.Text
' Calculate their sngSum... is the next line working?
SngSum = sngNumber1 + sngNumber2
' Display the result
LblSum.Text = sngSum.ToString
End Sub
A) A local variable is misplaced.
B) A conversion function such as CSng was not used.
C) The variable name sngNumberl was misspelled.
D) The variable sngSum was declared as the wrong data type.
Correct Answer:
Verified
Q16: The contents of a text box may
Q17: When you assign a value of one
Q18: In order to execute code before a
Q19: The statement to declare strName as a
Q20: The value returned by passing #12/31/10# to
Q22: Which statement is true regarding the CInt
Q23: Which of the following is not a
Q24: What is the purpose of using the
Q25: When you declare a constant, you must
Q26: What will be the value of intAnswer
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents