Article ID: 911793 - Last Review: December 6, 2006 - Revision: 2.3

How to enable the "Option Strict" and "Option Explicit" statements in Visual Basic applications

Expand all | Collapse all

INTRODUCTION

This article describes how to enable the Option Strict and Option Explicit statements in Microsoft Visual Basic applications for code-behind files and files that are contained in the App_Code folder.

MORE INFORMATION

To enable the Option Strict and Option Explicit statements in the code-behind files and files that are contained in the App_Code folder of a Visual Basic application, override the compiler configuration in the system.codedom section of the Web.config file for the application. To do this, add the following code to the Web.config file:
	<system.codedom>
		<compilers>
		<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="0"  />
		<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="0" />
		</compilers>
	</system.codedom>

REFERENCES

For more information about how to create the Web.config file for an ASP.NET application, click the following article number to view the article in the Microsoft Knowledge Base:
815179  (http://support.microsoft.com/kb/815179/ ) How to create the Web.config file for an ASP.NET application

APPLIES TO
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
Keywords: 
kbhowto kbtshoot kbinfo KB911793
 

Article Translations