New topic: Listbox not displaying data
<http://forums.realsoftware.com/viewtopic.php?t=47187> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message van_xan Post subject: Listbox not displaying dataPosted: Wed Mar 06, 2013 6:23 pm Joined: Sun Oct 21, 2012 11:59 pm Posts: 15 Listbox2.DeleteAllRows Dim num As Integer Dim sum As Integer num = Val(Listbox1.Cell(-1,1)) sum = num * 6 Listbox2.Cell(-1,1) = str(sum) Could anyone give me a clue as to why Listbox2 is not displaying any data? I have this under the Sub Action() for a PushButton if that makes any difference. Top timhare Post subject: Re: Listbox not displaying dataPosted: Wed Mar 06, 2013 7:47 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 12111 Location: Portland, OR USA Why are you using -1 for the row? That seems strange, as it should return a delimited string of all the values in column 1. You then set the values of column 1 in all the rows of listbox2, but there are no rows, so it does nothing. Quote:num = Val(Listbox1.Cell(-1,1)) This is essentially num = Val(ListBox1.Cell(0,1)) Quote:Listbox2.Cell(-1,1) = str(sum) Change this to Listbox2.Addrow str(sum) Top van_xan Post subject: Re: Listbox not displaying dataPosted: Wed Mar 06, 2013 8:31 pm Joined: Sun Oct 21, 2012 11:59 pm Posts: 15 -1 is how you tell it to select all rows is it not? I need it to select the data in the 2nd column of all the rows. I'm thinking I can do it 1 row at a time and just add a loop to it to increase the row by 1 until it gets to the end. Would that work? Top timhare Post subject: Re: Listbox not displaying dataPosted: Thu Mar 07, 2013 1:06 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 12111 Location: Portland, OR USA It does, but it gives them to you as a delimited string. You'd still have to parse it out and loop through the values. Best to loop through each row of the listbox and handle each one separately. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
