Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

OptionStrict Property

Visual Studio .NET 2003

Indicates whether implicit narrowing conversions are allowed. Visual Basic projects only. For more information on data conversions, see Widening and Narrowing Conversions.

[Visual Basic .NET]
Public Property OptionStrict() As prjOptionStrict
[Visual Basic 6]
Property Get OptionStrict() As prjOptionStrict
Property Let OptionStrict( _
   ByVal OnOrOff As prjOptionStrict _
) 
[C++]
HRESULT __stdcall get_OptionStrict(
   /* [out, retval] */ prjOptionStrict* retVal
);
HRESULT __stdcall put_OptionStrict(
   /* [in] */ prjOptionStrict OnOrOff
);
[C#]
prjOptionStrict OptionStrict {get; set;}
[JScript .NET]
public function get OptionStrict() : prjOptionStrict
public function set OptionStrict(
   OnOrOff: prjOptionStrict
)

Parameters

OnOrOff
A prjOptionStrict enumeration value. If prjOptionStrict.prjOptionStrictOn, then a narrowing conversion will generate an error at compile time. The default value for new projects is prjOptionStrictOff.

Remarks

Using the prjOptionStrictOn enumeration value prohibits implicit narrowing conversions, such as converting a long value to an integer value. Explicit conversions, using CType and other conversion functions, must be used instead. Note that even explicit conversions may fail at run time. For example, it is not possible to convert the string "ball" to an integer value.

This property may be overridden for a particular project item by using the Option Strict Statement.

This property is not meaningful in Visual C# projects.

Example

See ProjectType Property.

See Also

Option Strict Statement | Widening and Narrowing Conversions | CType Function | Build, Common Properties, <Projectname> Property Pages Dialog Box

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft