Real Software Forums
http://forums.realsoftware.com/

list numbering
http://forums.realsoftware.com/viewtopic.php?f=10&t=47945
Page 1 of 1

Author:  Rivo [ Wed May 22, 2013 5:23 am ]
Post subject:  list numbering

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

Author:  pixe656 [ Wed May 22, 2013 5:31 am ]
Post subject:  Re: list numbering

What's the error you are getting?

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

Pixe

Author:  JeremK [ Wed May 22, 2013 6:31 am ]
Post subject:  Re: list numbering

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

Author:  DaveS [ Wed May 22, 2013 8:11 am ]
Post subject:  Re: list numbering

dim i as integer

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

Author:  JeremK [ Wed May 22, 2013 8:35 am ]
Post subject:  Re: list numbering

Thanks for the correction DaveS ;)

Author:  Rivo [ Thu May 23, 2013 3:34 am ]
Post subject:  Re: list numbering

thanks.. ;)

Its worked..


Regards,
Rivo

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/