Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

ERROR : object or with block variable not defined

Posted on 2003-10-28
17
172 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

790 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