ERROR : object or with block variable not defined

i have a class, agrid

in it i have (among other things): public special as integer

i call a member of an array defined as follows : public Grid(0 to 3)

The line it spits out :

Grid(3).special = val(tempstr)

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You need to initialize array by the following way:

For i = 0 To 3
    Set Grid(i) = new grid

Bow you can work with Grid array members.
HyperonAuthor Commented:
I tried to use set Grid(0 to 3) = new aGrid

but that didnt work, ill try your idea
HyperonAuthor Commented:
Sorry, Didnt work
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

HyperonAuthor Commented:
sorry, the error is : object variable or with block variable not set
public Grid(0 to 3) as aGrid

dim i as long
For i = 0 To 3
    Set Grid(i) = new agrid

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HyperonAuthor Commented:
sorry, no results
HyperonAuthor Commented:
that isn't the actual part the error is coming up in though. It refuses to believe that we have set it as an integer or string.
can you paste your code?
HyperonAuthor Commented:
that last thign worked for one part though. However I have the same error in a different place now, oh well ill fiddle around some more trying to fix it.
HyperonAuthor Commented:
The new Line that doesn't work now is:-

If Len(tmparray(0)) > 0 Then Grid(tempint).N.Sq = tmparray(0)

it should work but I can't see just why it doesn't.
firstly what does tmparray contain

what is N in the Grid object

and what is Sq in the N object thats in the Grid object?

HyperonAuthor Commented:
the tmparray contains the info.

N stands for North(for a game)

Sq stands for Square.

sorry, I forgot to explain that lol. (it has nothing to do with a problem with what is in them.)
HyperonAuthor Commented:
Thanxs for all your help I sorted out the problem now and its all fixed and done, thanxs to everyone that helped.
HyperonAuthor Commented:
do you have to

set acollection = new collection

That depends if you declared 'acollection' like this

dim acollection as new collection

or this

dim acollection as collection

The universally accepted best method is the following

dim acollection as collection
set acollection = new collection
HyperonAuthor Commented:
HyperonAuthor Commented:
does it work the same for public acollection as collection?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.