NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Option Strict Statement

Restricts implicit data type conversions to only widening conversions. This explicitly disallows any data type conversions in which data loss would occur and any conversion between numeric types and strings.

Option Strict

Remarks

Visual Basic generally allows implicit conversions of any data type to any other data type. Data loss can occur when the value of one data type is converted to a data type with less precision or smaller capacity, however, a runtime error message will occur if data will be lost in such a conversion. Option Strict ensures compile-time notification of these types of conversions so they may be avoided.

In addition to the conditions described above, Option Strict generates an error for:

The following is a list of widening conversions:

Type Widens to
Boolean Object
Byte Short, Integer, Long, Decimal, Single, Double, Object
Char Integer, Long, Decimal, Single, Double, Object
Short Integer, Long, Decimal, Single, Double, Object
Integer Long, Decimal, Single, Double, Object
Long , Decimal, Double, Object
Single Double, Object
Double Object
Date , Object
String Object
Null Object
Nothing Object
Empty Object
Fixed-length String String, Object
class Object; any of the classes that it inherits from; any of the interfaces that it implements (for COM2 defined classes this will only include the interfaces listed in the class’s definition within it’s type library).
Interface Object; any of the interfaces that it inherits from.
Structure Object
Array Object

See Also

Example