Option Strict
The first line of the script has the entry:
Option Strict
Option Strict OFF
Option Strict OFF
reduces Visual Basic .NET
validation by turning off extra error messaging as you create scripts. This
enables you to take some shortcuts that reduce the development time. If Strict
is
OFF, then some syntax errors can cause problems.
Those problems are not caught through the validation.
Specify Option Strict OFF as the first line to disable the extra validation. Otherwise, Option Strict ON is assumed.
Option Strict ON
If Option Strict
line is not in the
script, the default value is ON; or you can add
Option Strict ON
to the first line to turn on the
Strict option.
You must be specific about data types. You are notified when a conversion of data types can result in some loss of data; or when a specific operand cannot be used with a data type.
With Option Strict ON
, the
configuration of the script must be more specific than if Option
Strict
is OFF. This is true,
especially for functions like objProperty where the returns can vary.
When the option is ON, implicit data type conversions are restricted to only widening conversions. This explicitly disallows any data type conversions in which data loss can occur and any conversion between numeric types and strings.
Specifically, you can assign an integer value to a long variable because
a long variable can hold more data than an integer. You can assign a double value to a
string because anything can be converted to a string. You cannot assign a string to a
double without explicitly converting it to a double (that is, Double d = CDbl(stringValue)
).