design - Limiting a value in a user form input -


say if have text box input user key in value.

this value passed function, say:

f(x,y) = x / y; 

where x,y user inputs.

in case, if y == 0, divide 0 error occur.

my question practice, section of code should responsible error checking? it

1) read text box value, automatically change value else if equal 0.

or

2) when 0 passed function f(x,y), within function, handle potential divide 0 error.

you want errors apply (such divide 0 error) caught function itself. don't want use function in different part , need rewrite same error checking (or worse, forget to).


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -