ListViews In Reverse
- Posted by Virtual B <behaviorself at netzero.net> Jul 27, 2001
- 374 views
Hi everyone, I was wondering if anyone knew a way to make a ListView add each new line to the bottom instead of putting each new item at the top (or possibly to keep things in numerical order according to what is in the first column...?). I'm working on a payroll program for our contractors here, and we enter the information right off their paysheets, but it is displayed in reverse order in the program. I ended up rearranging things myself, and it works pretty well...unless you delete something and add another entry. Here is the code I used to display the data properly: count = getCount(ListView28) lv3 = {} lv3 = repeat(0, count) lParams = repeat(0, count + 1) for i = 1 to count do lv3[i] = getItem(ListView28, i) end for eraseItems(ListView28) lParams[1] = addLVItem(ListView28, closefolder, lv1[1..4]) for j = 1 to count do--count to 1 by -1 do if length(lv3[j]) > 0 then --need this to keep from crashing lParams[j + 1] = addLVItem(ListView28, closefolder, lv3 [j].4]) else junk = message_box("Omitting item ", "Info", MB_ICONINFORMATION + MB_TASKMODAL) end if end for The "if length(lv3[j]) > 0 then" statement keeps the program from crashing, but it also deletes the entry at the top of the ListView. Any ideas? Thanks, Virtual B