This documentation is archived and is not being maintained.

OptionExplicit Property

Visual Studio .NET 2003

Indicates whether variables must be declared. Visual Basic projects only.

[Visual Basic .NET]
Public Property OptionExplicit() As prjOptionExplicit
[Visual Basic 6]
Property Get OptionExplicit() As prjOptionExplicit
Property Let OptionExplicit( _
   ByVal OnOrOff As prjOptionExplicit _
HRESULT __stdcall get_OptionExplicit(
   /* [out, retval] */ prjOptionExplicit* retVal
HRESULT __stdcall put_OptionExplicit(
   /* [in] */ prjOptionExplicit OnOrOff
prjOptionExplicit OptionExplicit {get; set;}
[JScript .NET]
public function get OptionExplicit() : prjOptionExplicit
public function set OptionExplicit(
   OnOrOff: prjOptionExplicit


A prjOptionExplicit enumeration value. A value of prjOptionExplicitOn indicates that variables must be declared. A value of prjOptionExplicitOff indicates that variables may be used without declaration. The default value for new projects is prjOptionExplicitOn.


The prjOptionExplicitOn enumeration value turns on checking for variable declaration. If you attempt to use an undeclared variable name, an error occurs at compile time. If you use prjOptionExplicitOff, all undeclared variables are of Object type.

This value may be overridden in a particular project item by using the Option Explicit Statement.

This property is not meaningful in Visual C# projects.


See ProjectType Property.

See Also

Option Explicit Statement | Build, Common Properties, <Projectname> Property Pages Dialog Box

Applies To: Properties Property (General Extensibility) | Properties Property (Visual Basic and Visual C# Project Object)