How can avoid at this line an OverflowException?
Posted
by SoMoS
on Stack Overflow
See other posts from Stack Overflow
or by SoMoS
Published on 2010-03-14T10:47:48Z
Indexed on
2010/03/14
10:55 UTC
Read the original article
Hit count: 303
LastInput.time is an Integer and m_idleTime is an Integer too. This line sometimes generates an Overflow exception, I think that this happens when both values are big negative values.
(Environment.TickCount - lastInput.time) > m_idleTime
How can I avoid that? With casting?
(CType(Environment.TickCount,Long) - CType(lastInput.time,Long)) > m_idleTime
Or maybe with this cast?
CType((Environment.TickCount - lastInput.time),Long) > m_idleTime
Thanks in advance.
© Stack Overflow or respective owner