Code center > Darwinbots Program Source Code

Help!

(1/2) > >>

Ulciscor:
OK I have defined a custom type as:

Type gene
    geneNum As Integer
    conditionDNA As String
    bodyDNA As String
End Type

and an array:

Public genome() As gene

And then when a button is clicked I have:

genePoint = genePoint + 1
With genome(genePoint)
    .geneNum = genePoint
    .conditionDNA = ""
    .bodyDNA = ""
End With

genePoint is an integer with a start value of 0.

The error I get in debug is:
"Object variable or with block variable not set."

What the heck is going on!?

Carlo:
Public genome() As gene

Here's the problem, I guess. You have declared the data type for genome, but you haven't instantiated it yet. This means, that genome is a pointer to a gene object, but you haven't created the object.

Try instead

Public genome() As new gene

Ulciscor:
Now it says 'Invalid use of New keyword' lol.

Is it clear what I'm trying to do or should I try and explain? The code is probably pretty crappy lol.

Botsareus:
Here is the problem, The code you posted Ulcisor WORKS PERFICT.

Post the whole .frm file so I can finaly have a clue where the problem is.

Ulciscor:
Here ya go

Navigation

[0] Message Index

[#] Next page

Go to full version