Possible Duplicate:
what’s an option strict and explicit?
Is it about case sensitivity? Complete noob here.
Possible Duplicate:
what’s an option strict and explicit?
Is it about case sensitivity? Complete noob here.
When option explicit is off visual basic allows you to implicitly declare a variable by assigning a value to it. This is a really bad idea as misspelling a variable name would silently create a new variable causing a very hard to find bug.
Option Explicit Off
Imports System
Public Class ImplicitVariable
Public Shared Sub Main()
a = 33
Console.WriteLine("a has value '{0}' and type {1}", a, a.GetType())
End Sub
End Class
According to MSDN:
Otherwise, you can just use a variable without having to declare it first.
They even included an example: