[Gambas-user] Object Array problem

wally wally at ...2037...
Fri Nov 9 15:36:40 CET 2012


What is bad in this code ?

' Gambas class file

Public Struct Tupel
  x As Integer
  y As Integer
End Struct
 
Public dataArr As New Tupel[]

Public Sub Button1_Click()

    Dim i As Integer
    Dim dataset As New Tupel
    
    For i = 0 To 9
        dataset.x = (i + 1)
        dataset.y = (i + 1) * 10
        dataArr.Add(dataset, 0)
        Print i, dataset.x, dataset.y
    Next
    
    Print "\n\n"
    
    For i = 0 To dataArr.Max
         
         Print i, dataArr[i].x, dataArr[i].y
         
     Next

End

Output:
0       1       10
1       2       20
2       3       30
3       4       40
4       5       50
5       6       60
6       7       70
7       8       80
8       9       90
9       10      100



0       10      100
1       10      100
2       10      100
3       10      100
4       10      100
5       10      100
6       10      100
7       10      100
8       10      100
9       10      100


project attached
thx wally



-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_gb001-0.0.1.tar.gz
Type: application/x-compressed-tar
Size: 5288 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20121109/0d81347b/attachment.bin>


More information about the User mailing list