ArgumentException

ArgumentException


The exception that is thrown when one of the arguments provided to a method is not valid.


Remarks

ArgumentException is thrown when a method is invoked and at least one of the passed arguments does not meet the parameter specification of the called method. When throwing an ArgumentException a meaningful error message describing the invalid argument, the name of the argument, as well as the expected range of values for the argument should be defined.

New exception classes derived from ArgumentException can be created starting with the ArgumentExceptionBase template class and modifying it accordingly.

ArgumentException uses the HResult COR_E_ARGUMENT, which is &H5.

See Also

Project VBCorLib Overview | Constructors | ExceptionMethods | Exception | ArgumentNullException | ArgumentOutOfRangeException

Implements:

Exception 
IObject 
SystemException 

Public:

Properties:

NameDescription
 Data (get)Returns a key/value collection used to contain user-defined specific information about the exception. 
 HelpLink (get)Gets a link to a help file associated with the exception. 
 HelpLink (let)Sets a link to a help file associated with the exception. 
 HResult (get)Gets the HRESULT, a coded numerical value that is assigned to a specific exception. 
 HResult (let)Sets the HRESULT, a coded numerical value that is assigned to a specific exception. 
 InnerException (get)Gets the exception that caused the Subclassed exception to be thrown. 
 Message (get)Gets the error message associated with the Subclass exception. 
 ParamName (get)Returns the parameter name that caused the exception. 
 Source (get)Gets a description of the source of the exception. 
 Source (let)Sets a description of the source of the exception. 

Methods:

NameDescription
 EqualsProvides a basic implementation of the Equals function of the IObject interface. 
 GetBaseExceptionGets the original exception that caused the chain of exceptions to occur. 
 GetHashCodeProvides a basic implementation of the GetHashcode function of the IObject interface. 
 ToStringReturns the exception message prepended with the type name of the Subclass Exception.