Exception handling is not useful for compile-time errors.

It should NOT be used for logic errors.

It should be used for runtime errors where something is completely out of your control.

Comments
As a vb.noob, .i completely Agree.:)

Exception handling is not useful for compile-time errors.

It should NOT be used for logic errors.

It should be used for runtime errors where something is completely out of your control.

we can use even for logical errors...isnt it?
suppose we have
dim a as integer=10
dim b as integer=0
dim c as integer
c=a/b
as this is logical error we use exception handlers to handle this
which means that we are using even to handle logical errors.

It would be MUCH better to test for zero and not divide by it than to let an exception occur. If you can predict it or prevent it, do so with code.

Exception processing is costly if your program is to continue running (doesn't just exit on the first exception).

A lot of coding is about control. The first step of maintaining control is ensure you have it in the first place :)

Edited 4 Years Ago by thines01: clarity

It would be MUCH better to test for zero and not divide by it than to let an exception occur. If you can predict it or prevent it, do so with code.

Exception processing is costly if your program is to continue running (doesn't just exit on the first exception).

A lot of coding is about control. The first step of maintaining control is ensure you have it in the first place :)

ok thanks for the reply..
And finally exception handling process is a costly one ...
Is this the final conclusion why u asked me to test for zero rather than dividing it?

>>Is this the final conclusion why u asked me to test for zero rather than dividing it?
.i think so As well.
reason: Running the Try/Catch/etc., it sends the p.c. into shock Not just your tiny little app.

Hope this helps.:)

>>Is this the final conclusion why u asked me to test for zero rather than dividing it?
.i think so As well.
reason: Running the Try/Catch/etc., it sends the p.c. into shock Not just your tiny little app.

Hope this helps.:)

yes thanks
the problem is solved..

This question has already been answered. Start a new discussion instead.