How do I handle an exception error if a user enters nothing or a letter into the input box when I have it declared as an integer.

--------------------------------------------------------------------------------

Member Avatar for iamthwee

Try...catch perhaps.

You say that

if input is <= 0 then
whatever error message.

Anything entered that is not an integer, when the data type is integer, it is considered less than (or in some cases equal to) 0 if I am not mistaken. This should also take care of it if a user enters nothing (which I'm pretty sure is considered as a value of 0).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.