RN Converter
|
|||
|
Rank: ? (1)
Member #: 29679 |
Hi guys,
I'm fairly new to this and trying to get my head around some of the more basic things in VB! I have written (probably the sort of "standard" beginners program), a Roman Numeral Converter. I have gotten so far, but I keep getting an "Overflow" error. I know that it means I am trying to do too many things within the argument, but I can't get my head around what to change to make it right, help would be much appreciated! Here is the sub code: Code:
Is it something to do with OnDigit being declared as "Byte"? Something was making me think that, but I'm a bit stuck up to that. Thanks a lot in advance! =] -SoLi » Post edited 2007-11-18, 11:05pm by SoLi.
|
||
|
|||
|
|||
|
Rank: ? (4821)
Member #: 3416 |
a byte should be fine up to 128, but i think your problem here might actually be from Len(strNumber) being zero. if you start from zero and go down, you're going to hit an overflow when you try to go past -128. try setting a breakpoint on the line that's throwing the error and check the values of the relevant variables to see what's going on.
also the byte and int types in vb are actually slower than long anyway (long is 32-bit, which is native on most computers -- int and byte have to get converted), so you could try changing to long to see if that clears things up. » Post edited 2007-11-19, 08:51am by misterhaan.
my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
|
||
|
Please login or register to post a reply.