-
Hi,
I want to add two byte variables together and if the resulting value is greater than 255, then i want the sum to be set at 255. So far, i have had no luck at all. i tried setting up a temporary int variable like this:
dim x,y,sum as byte
dim temp as integer
temp = x+y
if temp >255 then
sum = 255
else
sum = temp
end if
but i still get an overflow error. How do i fix this???
Shaheeb
-
You have to do something like this:
Code:
temp = CInt(x) + CInt(y)
-
you might have to do
Also, I am not positive though