Common Errors


Generating an error for testing

object o = null; 
string s = o.ToString();

ApplicationException

System.ApplicationException 

Occurs when


ArgumentException

System.ArgumentException 

Occurs when one of the arguments provided to a method is not valid
This is thrown when at least one of the passed arguments does not meet the parameter specification.


ArgumentNullException

System.ArgumentNullException 

Occurs when an argument to a method is Nothing or Null rather than an expected (or accepted) value
This is derived from ArgumentException


ArgumentOutOfRangeException

System.ArgumentOutOfRangeException 

Occurs when a method is invoked and at least one of the arguments passed to the method is not a null reference.
This is derived from ArgumentException


CannotRemoveControlException

Microsoft.Office.Tools.CannotRemoveControlException 

Occurs when an attempt is made to programmatically remove a control that was not added programmatically.


ControlNameAlreadyExistsException

Microsoft.Office.Tools.ControlNameAlreadyExistsException 

Occurs when you attempt to create a control with the same name as another control in your project.


ControlNotFound

?? 

Occurs if host controls added at design time are accidentally deleted and the file is saved and reopened


DivideByZeroException

System.DivideByZeroException 

Occurs when ??


InvalidCastException

System.InvalidCastException 

Occurs when ??


InvalidOperationException

Microsoft.Office.Tools.InvalidOperationException 

Occurs when


InvalidRangeException

Microsoft.Office.Tools.InvalidRangeException 

Occurs when you programmatically create a view control with a range that spans multiple areas.


NullReferenceException

System.NullReferenceException 

Occurs when


OperationCanceledException

System.OperationCanceledException 

Occurs when


OverflowException

System.OverflowException 

Occurs when an arithmetic, casting or conversion operation in a checked context results in an overflow.
An overflow occurs when an operation produces a value too large for the destination type, infinity or not a number


RangeNotOnWorksheetException

Microsoft.Office.Tools.RangeNotOnWorksheetException 

Occurs when a view control is created programmatically with a range that is not from the worksheet that corresponds to the control collection.


SetDataBindingFailedException

Microsoft.Office.Tools.SetDataBindingFailedException 

Occurs when an attempt is made to set a data binding fails


StackOverflowException

System.StackOverflowException 

Occurs when ??


ThreadAbortException

System.Threading.ThreadAbortException 

Occurs when a cell is made to the Abort method.


401 Unauthorized

The remote server returned an error

Catch ex As System.Net.WebException 
   If ex.Message.Contains("(401) Unauthorized.")


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext