Everything about the runtime error 6 – overflow
It might be the case that when the ‘if’ expression uses Byte data type, that you get the following error on running the code – runtime error 6 overflow. The reason for this is that Visual Basic does not evaluate Byte data type correctly in the if expression when compiled to Native code with optimizations.
To ensure that you don’t get the runtime error 6 (overflow) again, install Visual Studio 97 Service Pack 2 (SP2). The problem can also be addressed by compiling to P-code or compiling to Native Code with no optimizations or using a data type other than the byte data type in the if expression.