GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  VB.NET
Next Question 
 VB.NET  |  Question 1 of 60    Print  
What do you mean by 'Option Strict On' ?

  
Total Answers and Comments: 7 Last Update: April 07, 2009   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Anuj
 

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



Above answer was rated as good by the following members:
cherry2020
July 12, 2005 07:17:19   #1  
subbaraja        

RE: What do you mean by 'Option Strict On' ?
which will restrict the implicit type casting (defalut is off in vb.net)

 
Is this answer useful? Yes | No
October 18, 2005 09:44:46   #2  
kumaraswamy        

RE: What do you mean by 'Option Strict On' ?

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 cast 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.


 
Is this answer useful? Yes | No
January 05, 2006 08:42:03   #3  
Henry        

RE: What do you mean by 'Option Strict On' ?
It is a keyword used to restrict implicit type casting 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

 
Is this answer useful? Yes | No
January 13, 2006 07:42:53   #4  
sabir        

RE: What do you mean by 'Option Strict On' ?
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
 
Is this answer useful? Yes | No
November 14, 2007 07:50:57   #5  
Anuj        

RE: What do you mean by 'Option Strict On' ?

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


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
November 16, 2007 23:26:24   #6  
Neelam        

RE: What do you mean by 'Option Strict On' ?

If Off- Implicit conversion is allowed

If On – 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 ‘Implicit conversion

L convert.tolong(i) ‘ Explicit conversion


 
Is this answer useful? Yes | No
April 07, 2009 06:01:29   #7  
mubin4all Member Since: April 2009   Contribution: 5    

RE: What do you mean by 'Option Strict On' ?
Variable must have appropriate data type.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape