Hola,
tengo el siguiente código:
Código:
Try
iNumPW = CInt(Math.Floor(CDbl((Ancho -(SepLateral * 2)) / pAncho)))
Catch ex As DivideByZeroException
MsgBox(MsgDivZero, MsgBoxStyle.OKOnly, MsgAtencion)
Catch ex As OverflowException
MsgBox(MsgDesborda, MsgBoxStyle.OKOnly, MsgAtencion)
End Try
donde Ancho, SepLateral y pAncho son integer.
Supongamos el siguiente caso:
- Ancho=10
- SepLateral=1
- pAncho=0
Por tanto hay una división por cero.
Mi duda es:
¿Porque salta OverFlowException, en lugar de DivideByZeroException?