[Gambas-user] Create an array inside a class

Grahame White grahame at ...457...
Sun May 23 20:36:07 CEST 2004


Probably another silly question on my part but here goes :)

I'm trying to create a class that has an array of shorts in it, something 
like this :

list.class

	public name as string
	public row as short[]

I then declare a public version :

global.class

	static public mylist as list

So far all this seems to work. I've been trying to add 10 lines to row like 
this :

fmain.class

public sub form_open()

	dim i as byte

	for i = 1 to 10
		global.mylist.row.add(0)
	next

end


And this is where I'm getting problems. When I try running this short 
snippet of code all I get is a 'Null Object' error. So what is the correct 
way to do this? I've looked in the docs they sort of skim over the subject 
of arrays and the examples don't cover this much either.

Grahame




More information about the User mailing list