Solved

ERROR : object or with block variable not defined

Posted on 2003-10-28
17
171 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Validating VB6 Function 19 59
Access query that references subform 5 47
How to set the sa password in a vb6 code for sql connection 9 51
VBA Shell can't Find Word document 11 92
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

786 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