Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ERROR : object or with block variable not defined

Posted on 2003-10-28
17
Medium Priority
?
179 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 75 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

886 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