Option Explicit statement in vb.net

Any VB.net program has On mode of option explicit by default. If program has Option explicit On statement than it requires all variables have proper deceleration otherwise it gives compile time error now we talk about  another  mode Off - if  we are using  variables  without  declaration than  vb.net  create variable declaration automatically and program does not give an error

We can take an example for better understanding:

Option Explicit On

Public Class Form1
Private
Sub OptionExplicit()

        TempString = "Hello"

        MessageBox.Show(TempString)

    End Sub

End Class

Above program gives an error ‘Name TempString is not declared'

 

 

Option Explicit Off

Public Class Form1
   Private
Sub OptionExplicit()
        
 TempString = "Hello"
          
MessageBox.Show(TempString)
   End Sub

End Class               

 

Above program run continue with out error