Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Sep 20, 2017 1:28 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: list numbering
PostPosted: Wed May 22, 2013 5:23 am 
Offline

Joined: Tue Aug 29, 2006 4:04 am
Posts: 513
Location: Indonesia
Hi,
I want to put number on listbox based from listbox.listcount

dim i as integer
dim b as double
b=0
for i=0 to listBox1.listcount-1
Listbox1.cell(i,0)=b+1
next


I dont know why its not working.
Any Helps.?


Thanks

Regards,
Rivo


Top
 Profile  
Reply with quote  
 Post subject: Re: list numbering
PostPosted: Wed May 22, 2013 5:31 am 
Offline

Joined: Wed May 20, 2009 11:02 am
Posts: 423
What's the error you are getting?

Does the listbox have the rows you are trying to populate (you need to "addrow" first).

Pixe

_________________
Using RS2011r4.3 on Windows7.


Top
 Profile  
Reply with quote  
 Post subject: Re: list numbering
PostPosted: Wed May 22, 2013 6:31 am 
Offline

Joined: Thu Apr 10, 2008 6:03 am
Posts: 303
Location: Paris-La Défense, France
Hello,

Seeing your code, as you do not increment the "b" variable you should get a "1" on each row.

You could use the following code:

dim i as integer

for i=0 to listBox1.listcount-1
Listbox1.cell(i,0)=i+1
next

_________________
Check my Website for high quality custom controls and classes (no plugins) for Windows, Mac OS and Linux
REALBasic 2012 R2 on Win 7 & Mac OS X


Top
 Profile  
Reply with quote  
 Post subject: Re: list numbering
PostPosted: Wed May 22, 2013 8:11 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
dim i as integer

for i=0 to listBox1.listcount-1
Listbox1.cell(i,0)=STR(i+1)
next

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: list numbering
PostPosted: Wed May 22, 2013 8:35 am 
Offline

Joined: Thu Apr 10, 2008 6:03 am
Posts: 303
Location: Paris-La Défense, France
Thanks for the correction DaveS ;)

_________________
Check my Website for high quality custom controls and classes (no plugins) for Windows, Mac OS and Linux
REALBasic 2012 R2 on Win 7 & Mac OS X


Top
 Profile  
Reply with quote  
 Post subject: Re: list numbering
PostPosted: Thu May 23, 2013 3:34 am 
Offline

Joined: Tue Aug 29, 2006 4:04 am
Posts: 513
Location: Indonesia
thanks.. ;)

Its worked..


Regards,
Rivo


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group