> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Bill Johnson > Sent: Monday, August 14, 2006 8:17 PM > To: REALbasic NUG > Subject: Re: my silly listbox > > > On 14-Aug-06, at 5:03 PM, [EMAIL PROTECTED] wrote: > > > > Here is my code.... > > > > after it runs I am left with the number 20 in what I would > call cell > > 0,1 > > > > Regards > > > > ======================== > > dim i as integer > > me.HasHeading=true > > > > me.heading(0)="Heading1" > > me.Heading(1)="heading2" > > > > me.addrow"" > > > > for i = 1 to 20 > > me.Cell(0,0)=str(i) > > next i > > The first parameter of the cell property is its row number > and the second is its column number. When you say > > > for i = 1 to 20 > > me.Cell(0,0)=str(i) > > next i > > you're addressing the cell at row 0 and column 0 which is > the first cell in the listbox no matter how many rows you add. > > To fill in the cells of the row you've just added with the > cell's column index increment the column parameter. > dim i as integer > me.HasHeading=true > > me.heading(0)="Heading1" > me.Heading(1)="heading2" > > me.addrow"" > > for i = 0 to 20 > me.Cell(me.lastIndex,i)=str(i) > next > > LastIndex is the index of the last row added to the listbox > which is the one you've just added with me.addrow"".
Well, sure, but me.addrow is not inside the loop, so at the end of the day he's still only going to have one row in the listbox and at some point he's going to be addressing columns which don't exist, unless he has 20+ column; i.e., at the end, he's setting column #20 -> me.cell(0,20) = 20 _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
