Concept explainers
The statement lblTotal.Text = Val(txtQuantity.Text+3) does not calculate properly.
Hence, the correct answer is option “C”.
Explanation of Solution
Evaluate the statement
Assignment statement is the type of instruction that assigns a value to the property of the object during the run time.
Syntax of an assignment statement:
Object.property = expression
Object and property are the name of the object and property where the expression is to be stored.
Either the numbers, letters, special characters, property of the control, or value, can act as an expression.
In the given statements, the following assignment statement does not calculate correctly:
lblTotal.Text = Val(txtQuantity.Text +3)
The Val(txtQunatity.Text+3) function concatenates both the values since ‘+’ sign acts as a concatenate operator inside the Val() function.
Therefore, “the statement lblTotal.Text = Val(txtQuantity.Text+3) concatenates the values instead of text conversion and stores it in the destination”.
Want to see more full solutions like this?
Chapter 2 Solutions
Programming with Microsoft Visual Basic 2015 (MindTap Course List)
- Which of the following expressions evaluates to True when the strItem variable contains the string 1234Y5? a. strItem Like ####[A-Z]# b. strItem Like 9999 [A-Z] 9 c. strItem Like ###### d. None of the above.arrow_forwardWhich of the following C# expressions means, If itemNumber is not 8 or 9, add TAX to price? If(itemNumber !=8 || itemNumber !=9) price = price + Tax; If(itemNumber ! = 8 If(itemNumber ! = 8 Two of thesearrow_forwardWhich of the following statements formats the contents of the dblNet variable with a dollar sign and two decimal places? a. lblNet.Text = dblNet.ToCurrency("C2") b. lblNet.Text = dblNet.ToString("C2") c. lblNet.Text = ToString(dblNet , "C2") d. lblNet.Text = dblNet.ToFormat("C2")arrow_forward
- Which of the following statements displays a dialog box that prompts the user for a name, and then assigns the user’s response to the strPet variable?a. InputBox("Name:", "Pet Name", strPet) b. InputBox("Name:", strPet) c. strPet = InputBox("Name:", "Pet Name") d. none of the abovearrow_forwardWhich of the following operators reverses the meaning of a test statement?a. #!b. -oc. -ad. !arrow_forwardIf the txtNum control contains the value 92, which of the following expressions evaluates to the number 2? a. (Val(txtNum.Text) + 8) / 50b. Val(txtNum.Text) Mod 45 c. Val(txtNum.Text) \ 45 d. all of the abovearrow_forward
- If Option Strict is set to On, which of the following statements assigns the sum of two Integer variables to the Text property of the lblTotal control? a. lblTotal.Text = (intN1 + intN2).ToString b. lblTotal.Text = intN1.ToString + intN2.ToString c. lblTotal.Text = intN1 + intN2.ToString d. lblTotal.Text = ToString(intN1 + intN2)arrow_forwardWhich of the following expressions evaluates to True when the strItem variable contains the string “1234Y5”? a. strItem Like "####[A-Z]#" b. strItem Like "9999[A-Z]9" c. strItem Like "######" d. None of the above.arrow_forwardWhich of the following will not display the number 123 on each of two lines in the lblMsg control? (The intY variable was declared with the statement Dim intY As Integer.)a. For intX As Integer = 1 To 2intY = 1DolblMsg.Text = lblMsg.Text & intY.ToStringintY += 1Loop Until intY > 3lblMsg.Text = lblMsg.Text & ControlChars.NewLineNext intX b. intY = 1Do Until intY > 2For intX As Integer = 1 To 3lblMsg.Text = lblMsg.Text & intX.ToStringintY = intY + 1Next intXlblMsg.Text = lblMsg.Text & ControlChars.NewLineLoopc. For intX As Integer = 1 To 2intY = 1Do Until intY > 3lblMsg.Text = lblMsg.Text & intY.ToStringintY += 1LooplblMsg.Text = lblMsg.Text & ControlChars.NewLineNext intXd. intY = 1Do Until intY > 2For intX As Integer = 1 To 3lblMsg.Text = lblMsg.Text & intX.ToStringNext intXintY = intY + 1lblMsg.Text = lblMsg.Text & ControlChars.NewLineLooparrow_forward
- If Option Strict is set to On, which of the following statements will assign the contents of the txtSales control to a Double variable named dblSales? a. dblSales = txtSales.Text b. dblSales = txtSales.Text.Convert.ToDouble c. Double.TryParse(txtSales.Text, dblSales) d. TryParse.Double(txtSales.Text, dblSales)arrow_forwardWhich of the following is a wrong code. Select one: a. All the above b. texbox3.text = val(textbox1.text) + Val(texbox2.text) c. textbox3.text = val(textbox1.text) * val(textbox2.text) d. textbox3.value = val(textbox1.text) + val(textbox2.text)arrow_forward3. Which among the following shows a valid use of the Direction enumeration as a parameter to the moveCharacter function? Select al that apply. enum Direction { case north, south, west, east}func moveCharacter(x: Int, y: Int, facing: Direction) {// code here} moveCharacter(x: 0, y: 0, facing: .southwest) moveCharacter(x: 0, y: 0, facing: Direction.north) moveCharacter(x: 0, y: 0, facing: .south) moveCharacter(x: 0, y: 0, facing: Direction.northeast)arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,