Division by Zero

If your program attempts to evaluate an expression which contains a divisor = 0 your program will throw a unhandled exception 

division by zero exception' 

Sometimes the error is

 

If you want to know why your program cannot handle division by zero visit the following site.
 
Division by Zero – What it means
 
Because it is unacceptable for a program to throw a unhandled exception
 
 programmers must write their code so that division by zero never happens.
 

If intDivisor <> 0 Then

       decAnswer = Convert.ToDecimal(intNumber / intDivisor)

End If
 
Note: Because division often results in numbers that are NOT whole number you should always store the result of a division in a floating point data type.