Code center > Darwinbots Program Source Code

Help!

<< < (2/2)

Botsareus:
P. S. make sure this stuff is in a bas file:

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

and an array:

Public genome() As gene
--- End quote ---

and that you redim genome() to atleast 1 before you click that button, otherwise you got a non-exsistent array

P. P. S.

Ulcisor, they got the breack button on the error menu for a reason , click it , it will go to the line were the error is. If you still have no clue how that line caused the error go to View > Calls Stack , but you really have to understand the languge well to go through all that code bc calls stack builds up really quickly sometimes.

Ulciscor:
Lol I seem to have sorted it out now sorry. It was doing some crazy stuff before.

Botsareus:
scratch the bas idea , this should work fine:


--- Quote ---Option Explicit
'Set up arrays and variables
Private Type gene
    geneNum As Integer
    conditionDNA As String
    bodyDNA As String
End Type

Private genome() As gene
Private genePoint As Integer
Private Sub Form_Load()
genePoint = 0
ReDim genome(20) ' 20 you like 20 ???
End Sub

Private Sub lblAddNew_Click()
genePoint = genePoint + 1
With genome(genePoint)
.geneNum = genePoint
.conditionDNA = ""
.bodyDNA = ""
End With
End Sub
--- End quote ---

Botsareus:
lol you beat me to it.

Ulciscor:
I had to rewrite it to this:

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

Navigation

[0] Message Index

[*] Previous page

Go to full version