English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Dim number() As Integer
Dim a As Long
number(10) = inputNum.Text // the error appears here
a = number(10) * 100000000
Print a

2006-08-08 20:42:46 · 6 answers · asked by Anonymous in Computers & Internet Programming & Design

dim s as long
print s*1000000000 // error: overflow also

2006-08-08 21:14:40 · update #1

6 answers

You have exceeded the limit for that datatype. Try a floating point datatype, like a double.

2006-08-08 20:47:01 · answer #1 · answered by © 2007. Sammy Z. 6 · 0 0

I don't know what the value for "inputNum.Text" is, it could be that the number you're providing via inputNum is too large to be an integer.

If the above is correct then you can try "Dim number() As Long" instead. If you still get an overflow error, you can also try "Dim number() As Variant".

Hopefully that helps!

Edit: I just tried to recreate your error however I received "Subscript out of range" which is due to not dimensioning the array like the above Yahoo user suggested.

If you know what the upper bound of you array will be you can try Dim number(10) As Integer. If you however do not know what the upper bound will be you can also increase it's bound by ReDim number(UBound(number) + 1). If you wish to keep all the values in your array you can try ReDim Preserve number(UBound(number) + 1 ).

2006-08-08 20:52:23 · answer #2 · answered by Nesquik 2 · 0 0

except you're getting into in some extremely super numbers, the main probable reason is a counter variable in a limiteless loop. i will not be able to remember if vb throws an overflow errors for branch by applying 0, yet you are able to verify that too.

2016-11-04 04:43:56 · answer #3 · answered by Anonymous · 0 0

Try this:

Private Sub Command1_Click()
Dim number As Variant
Dim a As Variant

number = InputBox("enter#:")
a = number * 100000000

MsgBox a
End Sub

2006-08-08 23:19:23 · answer #4 · answered by VBACCESSpert 5 · 0 0

long is not long enough to take 100000000
use dim a as single or double

2006-08-09 00:35:25 · answer #5 · answered by Tanveer Ahmed 3 · 0 0

i really don't know VB
but i guess the error came from using the array without identifying it's dimension
note:VB is sh*t learn C# or Java better

2006-08-08 20:51:06 · answer #6 · answered by Anonymous · 0 0

fedest.com, questions and answers