StrictOn would still not (Verizon web hosting) allow the conversion and

StrictOn would still not allow the conversion and would instead generate a compiler error. The reasoning here is that, although particular narrowing operations may not lose data, there is always the potential for data loss when working with variables that is, with symbolic representations of numbers whose values are allowed to vary. Rules at a Glance If the OptionStrict statement is not present in a module, OptionStrict is Off. The default is OptionStrictOn. In other words, the statement: Option Strict On is equivalent to the statement: Option Strict The OptionStrict statement must appear in the declarations section of a module before any code. Option Strict On disallows all implicit narrowing conversions. OptionStrictOn also causes errors to be generated for late binding, as well as for any undeclared variables, since OptionStrictOn implies OptionExplicitOn. Programming Tips and Gotchas Although the setting of OptionStrict has no effect on BCL data types, BCL data types disallow implicit narrowing conversions. Explicit narrowing conversions are not affected by OptionStrict. However, if data loss does occur as a result of an explicit conversion, an OverflowException exception is generated. One of the most commonly overlooked narrowing conversions is the use of “wider” arguments in function, procedure, and method calls. Passing a Long to an Integer parameter, for example, is an implicit narrowing conversion that OptionStrict does not allow. In many cases, OptionStrictOn disallows seemingly “safe” conversions because it interprets literal values in unexpected ways. For example, the statement Dim decNum As Decimal = 10.32 generates a compiler error because 10.32 is interpreted as a Double, and implicit conversions from Double to Decimal are not allowed. You can correct this compiler error with a statement like: Dim decNum As Decimal = 10.32D Setting OptionStrictOn is highly recommended. For an ASP.NET page, you use the @Page directive rather than OptionStrict to control strict type checking. Its syntax is: <%@ Page Language="VB" Strict=true|false %> By default, Strict is false in ASP.NET pages. You can also use the section of the WEB.Config file to control strict type checking for an entire virtual directory or ASP.NET application by adding a strict attribute to the compilation section. Its syntax is:

Hint: If you are looking for very good and affordable webspace to host and run your j2ee hosting application check Sandzak.com j2ee web hosting services

Comments are closed.