Add-ins and Option Strict

Build 1501 on 14/Nov/2017  This topic last edited on: 13/Sep/2015, at 14:22

The Options strict in the add-ins (properties of the project, Compile, Compile Options) is turned on by default in system add-ins, but it may be turned off in custom add-ins.

The Option Strict is available in the Microsoft Visual Basic .NET. For more information, see http://support.microsoft.com/kb/311329.

It is highly recommended to turn on Option Strict also in your custom add-ins.

To turn on the Option Strict on your custom add-ins

1.Open the add-ins solution, and then right-click a custom project in the Solution Explorer.

2.Click the Compile tab.

3.Under Compile options, on the Option strict,. select On. The default value is Off.

4.Repeat this for all custom add-ins.

5.Click to toggle graphic size

Option Strict restricts implicit data type conversions to only widening conversions. Widening conversions explicitly do not permit any data type conversions in which data loss may occur and any conversion between numeric types and strings.

When you use the Option Strict statement, the statement must appear before any other code. In Visual Basic .NET, you can typically convert any data type to any other data type implicitly. Data loss can occur when the value of one data type is converted to a data type with less precision or with a smaller capacity. However, you receive a run-time error message if data will be lost in such a conversion. Option Strict notifies you of these types of conversions at compile time so that you can avoid them.

Option Strict also generates an error message in the following scenarios:

For any undeclared variable. This is because Option Strict also implies Option Explicit.

Late binding.