| Constructors: NewArgumentNullException |
Creates a new ArgumentNullException object.
Public Function NewArgumentNullException( ByVal Message As String, Optional ByVal ParamName As String, Optional ByVal InnerException As Exception ) As ArgumentNullException
When throwing an ArgumentNullException a meaningful error message describing the invalid argument and the name of the argument should be defined.
' Throws a default ArgumentNullException object
Throw New ArgumentNullException
' Throws an ArgumentNullException with a custom message and parameter name
Throw Cor.NewArgumentNullException("A valid object is required.", "MyParam")
' Throws an ArgumentNullException with a custom message and error code and parameter name
Dim ex As ArgumentNullException
Set ex = Cor.NewArgumentNullException("A valid object is required.", "MyParam")
ex.HResult = 123
Throw ex
This example shows how to throw three different variations of the same ArgumentNullException object.
Project VBCorLib Overview Class Constructors Overview Constructors Properties Constructors Methods NewArgumentException NewArgumentOutOfRangeException ArgumentNullException