Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN: 9781337102124
Author: Diane Zak
Publisher: Cengage Learning
bartleby

Concept explainers

Question
Book Icon
Chapter 3, Problem 4MQ6
Program Plan Intro

Option Strict On:

The Option Strict On statement is used to prevent the data loss in the implicit type conversion.

  • If one data type value is converted to a narrower data type, then smaller number or number with fewer precision data loss is occurred in the implicit conversion.
    • For example,
    • Consider the statement Dim intValue As Integer = 18.36
      • Here, the double value is converted as integer number and stored into the memory location.
      • In the implicit conversion, the value is rounded off by the nearest whole number and the decimal portions are removed.
      • At the final result, the number is stored as 18, so the decimal part .36 is removed from the number. Here, the data loss has been occurred.
    • If the Option Strict is On, then it will not allow the implicit conversion; it raises a warning while the program tries to perform an implicit conversion.
  • When the Option Strict is on, it does not allow the following conversions:
    • String to number implicit conversion is not allowed.
    • Number to string implicit conversion is not allowed.
    • Wider data types to narrower data types implicit conversion is not allowed.
    • Implicitly narrower data types are promoted as wider data types.

Blurred answer
Students have asked these similar questions
Compare userNumber with compareNumber and display 'Numbers are not equal' if the numbers are different. Then, display 'Variables are not identical' if the variables are not identical (not strictly equal). let compareNumber = 3; // Code will be tested with: 3, 8, 42let userNumber = '3'; // Code will be tested with: '3', 8, 'Hi'
What must be placed on the blank part of the code so that ? will be from ? to ?.
What value is returned by the IndexOf and LastIndexOf methods if the substring being searched for is not found?

Chapter 3 Solutions

Programming with Microsoft Visual Basic 2017

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning