Resolved Question
What do you mean by Option Strict On ?
 
Details:
  asked by: dominum  on: Apr 18, 2009  
 Best Answer ! ! !
projectpop2009 's Answer  ( this answer is maked as best answer of this question at: Apr 30, 2009 )


When we want that type conversion of data types must done explicitly then we enable the 'Option Strict'.



2 comments  answered on: Apr 25, 2009 
Other Answer (7)
which will restrict the implicit type casing (defalut is off in vb.net)
  thatevil   answered on£ºApr 19, 2009  0 comments

Option Strict

Visual Basic language in general does not require explicit syntax to be used when performing operations that might not be optimally efficient (e.g. late binding) or that might fail at run time (e.g. narrowing conversions). This permissive semantics often prevents detection of coding errors and also affects the performance of the application.

VB.NET enables a programmer to enforce strict semantics by setting this option to On . When used this option should appear before any other code. This option can be set to On or Off . If this statement is not specified by default it is set to Off .

Syntax: Option Strict [On / Off]

When it is set to On it disallows any narrowing conversions to occur without an explicit cas operator late binding and does not let the programmer omit As clause in the declaration statement. Since setting it to On requires explicit conversion it also requires that the compiler be able to determine the type of each variable. Thus it is implied that Option Strict also means Option Explicit.

Visual Basic .NET allows implicit conversions of any data type to any other data type. However data loss can occur if the value of one data type is converted to a data type with less precision or a smaller capacity. Setting this option to On ensures compile-time notification of these types of conversions so they may be avoided.

  kamiru   answered on£ºApr 20, 2009  0 comments

It is a keyword used to restrict implicit type casing if its set to on
because Visual basic provides implicit type conversion between any data types
whereas In C#.net is strong type safe language
  cute_wormz   answered on£ºApr 22, 2009  0 comments

this is the concept in vb where in vb we are option strict is indiacted that the when ever we use the verible that it has to be declared else it will thuorgh error but in vb by defalut the option strict off but in case if net option strict will be on
  neverendbk   answered on£ºApr 24, 2009  0 comments

When we want that type conversion of data types must done explicitly then we enable the %26#39;Option Strict%26#39;.

  tortoise18   answered on£ºApr 26, 2009  0 comments

If Off- Implicit conversion is allowed

If On %26ndash; Implicit conversion is not allowed. U need to use system.convert

e.g of Implicit conversion and Explicit conversion

Dim I as short 32638

Dim l as long

L I %26lsquo;Implicit conversion

L convert.tolong(i) %26lsquo; Explicit conversion

  xxleoleoxx   answered on£ºApr 28, 2009  0 comments

Variable must have appropriate data type.
  mrhandsomeabit   answered on£ºApr 29, 2009  0 comments

Hot Questions

Contact Us - IT-Interview