kevinfishburne ha scritto: > I have some code: > > PUBLIC myarray AS String[10000, 2] > ... > myarray[x, 0] = stuff > myarray[x, 1] = morestuff > myarray[x, 2] = evenmorestuff > > and receive an "out of bounds" error message when referencing the third > array element assignment (myarray[x, 2] = evenmorestuff). > > I can only assume that the array declaration defines the total number of > elements and that referencing the array elements starts at zero. In other > possibly more confusing words: > > PUBLIC myarray AS String[10000, 2] = 10000x2 total elements > > and > > myarray[x,y] = myarray[0-9999,0-1] > > I think my confusion may have come from my old VB6 days with "OPTION BASE" > and all that crapola. Someone please confirm that GAMBAS works as I > speculated or let me know if I'm missing something. Thanks all. > > I think you posed a question and replied to it by yourself... :-)
The upper bound, 2 in this case, declares the number of elements, as in C, and those elements are numbered from 0 to 1. This idea is common in many other places; for example, all .Count properties say how many elements are in the object (columns in a gridview, elements in a collection...), but you address those elements from 0 to Count-1. Regards, -- Doriano Blengino "Listen twice before you speak. This is why we have two ears, but only one mouth." ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user