![]() |
Hello,
I'm a beginner in VB and I'm having trouble with my code. It's a prime number calculator. Here is the function: :
Public Function prime(x As Integer)When I run the code I get "Array already dimentioned." |
Some of your variables are misspelled, others are undefined... I don't have VB on hand right now, but try this:
:
Public Function prime(ByVal x As Integer) |
edit: ignore what i wrote if you read it.
|
it was pretty good advice too Berto.
The code above compiles and runs fine in VB .NET |
nah i said something that was wrong, by a mile so thought i should get rid of it.
|
In VB (not sure about VB .NET, but as you're not using that, it's irrelevant), if you want to redimension an array, you have to define it without any dimensions:
:
Dim primes() as IntegerThen redimension it at the start. |
| All times are GMT -5. The time now is 4:11 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC