Returns the error message for the indexed error in the error object. If there is no error message at the indicated index, the method returns the empty string.
The NumMessages property indicates the number of error message and number pairs in an error object. Specify an index between 1 and the value of the NumMessages property.
For a .NET System.Exception class, the information from the current object reference is used to populate message 1. If there is an InnerException, its information is used to populate message 2. This process continues down through any other nested InnerExceptions. The format of each message is:
Exception-Typename:Message
For example, if you pass the value 2 to access the third member of a control collection and there are less than three elements in the collection you will get this message:
System.ArgumentOutOfRangeException: Index 2 is out of range
The string "Index 2 is out of range" is the value of the Exception Message property.