Option infer,option strict,option compare,option explict in vb.net
Sources :
About.com, Google.com and my knowledge
Back to the Future – VB6 Variant Redux?
In VB6, we could use a variable without declaring it as …
myVar1 = “whatever”
myVar2 = 666
The variables were compiled as Variant types, which could hold anything.
This was carried over into .NET as Object types. If Option Explicit is Off, then you can write the same code and the variables became Object types. Again, they could hold anything. But the default changed in .NET (Option Explicit is On by default) and we were strongly encouraged to declare everything. Not only did it help the compiler catch errors so the application didn’t crash at runtime, but the code ran faster because the variables were “early bound” instead of “late bound”. With late binding, the compiler has to add code to figure out what a variable is before using it and that slows everything down. VB 6 was slower for the same reason.
The Option Strict statement
By default, the Visual Basic .NET or Visual Basic compiler does not enforce strict data typing. To change this default behavior, see the Change the Default Project Values section.
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. For more information about widening conversions, see the Widening Conversions section.
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.
For Option Compare please visit : http://msdn.microsoft.com/en-us/library/8t3khw5f(v=vs.80).aspx
If you have got any suggestions and comments plase let us know