[Gambas-user] Null Object

Maurizio Pozzobon mauriziopz at ...626...
Sat Jul 9 13:11:35 CEST 2005


hi list
I'm writing a little program in gambas 1.0.6, but I've have a problem, the 
sub I'm writing need to check the value of an integer array (TotI) and based 
on the value of TotI add the corresponding object of another array in a 
third array of objects, I know it seams crazy! here is the code I've 
written:

SUB check() ' find the better line to draw
DIM i AS Integer
DIM j AS Integer
DIM ZeroClick AS Object[] 'square with all borders unclicked
DIM Zc AS Integer 'Counter for zeroclick
DIM OneClick AS Object[] 'square with 1 border clicked
DIM Oc AS Integer 'Counter for Oneclick
DIM TwoClick AS Object[] 'square with 2 borders clicked
DIM Twc AS Integer 'Counter for Twoclick
DIM ThreeClick AS Object[] 'square with 3 borders clicked
DIM Thc AS Integer 'Counter for Threeclick
FOR i = 0 TO nbx - 1
FOR j = 0 TO nby - 1
IF TotI[i,j]=0 THEN 
zeroclick.Add(Tot[i,j],Zc)
Zc =Zc + 1 
ELSE
IF TotI[i,j]=1 THEN 
Oneclick.Add(Tot[i,j],Oc)
Oc =Oc + 1 
ELSE
IF TotI[i,j]=2 THEN 
Twoclick.Add(Tot[i,j],Twc)
Twc =Twc + 1 
ELSE
IF TotI[i,j]=3 THEN 
Threeclick.Add(Tot[i,j],Thc)
Thc =Thc + 1 
END IF
END IF
END IF
END IF
NEXT
NEXT
END

My problem is that when gambas reach the "zeroclick.Add(Tot[i,j],Zc)" 
command give me an error, Null object, I can't understand what's the 
problem, I even tried to simply resize the array zeroclick but gambas give 
me the same error.

Thanks

-- 
Maurizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20050709/96734782/attachment.html>


More information about the User mailing list