Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Foxpro 6.0 SP5 ListBox RemoveItem/RemoveListItem Problem

139 views
Skip to first unread message

Simon

unread,
Sep 23, 2004, 11:57:35 PM9/23/04
to
I am using Foxpro 6.0 SP5, I have a problem about ListBox Control:

- I am using a ListBox Control with RowSourceType = 0
- I have add the item as
a
b
c
d
- When I use RemoveItem/RemoveListItem to remove the item at middle
like 'c', the list become
a
b
d
and the listcount=3, it seem valid until now.
- However, when I using the loop
for i=1 to listbox.listcount
messagebox(listbox.listitem(i)
next

I get the value of "a", "b", ""
- I use debug watch and find that the value of "d" still in
listbox.listitem(4)
- I have tried refresh but not effect in the result
- Is it a bug in foxpro sp5?
- Any one have same problems?

Stefan Wuebbe

unread,
Sep 24, 2004, 2:40:34 AM9/24/04
to
The attempt below seems to work as expected for me in Vfp8SP1
as well as in Vfp6SP5. Can you modify it to show the effect?


hth
-Stefan

LOCAL i

IF PEMSTATUS(_screen, 'List1', 5)
_screen.RemoveObject('List1')
ENDIF
_screen.AddObject('List1','Listbox')
WITH _screen.List1
.Move(100,20)
.AddItem("a")
.AddItem("b")
.AddItem("c")
.AddItem("d")
.Visible = .T.
WAIT WINDOW
.RemoveItem(2)
FOR i = 1 TO .ListCount
? .List(i)
NEXT
ENDWITH


"Simon" <sleun...@yahoo.com.cn> schrieb im Newsbeitrag
news:823baa81.0409...@posting.google.com...

praetorik35

unread,
May 15, 2013, 5:32:33 AM5/15/13
to
I had the same problem and after some time of looking for a solution I just
realized that I could use LIST instead of LISTITEM and the problem just
disappeared....It seems it's because LISTITEM depends on LISTITEMID and LIST
not, that's why I didn't have the same problem..Test it!
0 new messages