| Constructors: NewArgumentException |
Creates a new ArgumentException object.
Public Function NewArgumentException( ByVal Message As String, Optional ByVal ParamName As String, Optional ByVal InnerException As Exception ) As ArgumentException
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.
' Throws a default ArgumentException object
Throw New ArgumentException
' Throws an ArgumentException with a custom message and parameter name
Throw Cor.NewArgumentException("Your argument is wrong.", "MyParam")
' Throws an ArgumentException with a custom message and error code and parameter name
Dim ex As ArgumentException
Set ex = Cor.NewArgumentException("Your argument is wrong.", "MyParam")
ex.HResult = 123
Throw ex
This example shows how to throw three different variations of the same ArgumentException object.
Project VBCorLib Overview Class Constructors Overview Constructors Properties Constructors Methods NewApplicationException NewArgumentNullException ArgumentException