Reputation: 1686
I believe this question is sort of open ended, but I am seriously struggling. I keep getting an over flow.
I have two longs. The first is set to 16552800. I can add 32760 to it no problem. However I get an overflow error when I add 32820 to is.
Any ideas?!?!?!
Thanks!!!
Upvotes: 2
Views: 6106
Reputation: 838376
A long in Visual Basic 6 is 32 bits and has a range from 2,147,483,648 to 2,147,483,647. You are nowhere near this limit. In VB.NET it is 64 bit.
It seems that you get an error when you add a number greater than or equal to 215 = 32768. Could you try 32767 and 32768 and see if that is the point at which the error starts occurring?
Are you sure that the overflow is coming from the addition? I suspect that you are trying to assign 32820 to a signed integer (range -32768 to +32767), and it's this assignment that gives the overflow, not the addition.
Upvotes: 1