Solved

ERROR : object or with block variable not defined

Posted on 2003-10-28
17
169 Views
Last Modified: 2010-05-03
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)

0
Comment
Question by:Hyperon
  • 12
  • 4
17 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9632540
You need to initialize array by the following way:

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

Bow you can work with Grid array members.
0
 

Author Comment

by:Hyperon
ID: 9632649
I tried to use set Grid(0 to 3) = new aGrid

but that didnt work, ill try your idea
0
 

Author Comment

by:Hyperon
ID: 9632658
Sorry, Didnt work
0
 

Author Comment

by:Hyperon
ID: 9632661
sorry, the error is : object variable or with block variable not set
0
 
LVL 13

Accepted Solution

by:
crazyman earned 25 total points
ID: 9632888
public Grid(0 to 3) as aGrid

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

Author Comment

by:Hyperon
ID: 9633498
sorry, no results
0
 

Author Comment

by:Hyperon
ID: 9634293
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.
0
 
LVL 13

Expert Comment

by:crazyman
ID: 9634308
can you paste your code?
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:Hyperon
ID: 9634320
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.
0
 

Author Comment

by:Hyperon
ID: 9634371
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.
0
 
LVL 13

Expert Comment

by:crazyman
ID: 9634674
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?

0
 

Author Comment

by:Hyperon
ID: 9634748
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.)
0
 

Author Comment

by:Hyperon
ID: 9636994
Thanxs for all your help I sorted out the problem now and its all fixed and done, thanxs to everyone that helped.
0
 

Author Comment

by:Hyperon
ID: 9644700
do you have to

set acollection = new collection

?????
0
 
LVL 13

Expert Comment

by:crazyman
ID: 9648415
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
0
 

Author Comment

by:Hyperon
ID: 9648505
thanks
0
 

Author Comment

by:Hyperon
ID: 9648526
does it work the same for public acollection as collection?
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now