Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's wrong with this code. I get an error.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00350228
Message ID:
00350249
Views:
23
>DO CASE
>CASE m.stype = 1
>FOR i = 1 TO THISFORM.lstSlist4.ListCount
>IF LEFT(THISFORM.lstSlist4.List(i),LEN(ALLTRIM(m.stext))) ;
>!= alltrim(m.stext)
>THISFORM.lstSlist4.RemoveItem (THISFORM.lstSlist4.ListIndex)
>ENDIF
>ENDFOR
>
>I have this code in a command button that does a partial search on a drop-down list in my combobox. If the partial search text does not match the item in the combobox list, I want to Remove the item from the combobox. But I get an error on the THISFORM.lstSlist4.RemoveItem command line. Am I even close? I have never done this before. I think I am close. Help please. And thank you.

You'll need to run your loop backwards through the list, otherwise you're changing the length of the list while you are in the loop.

FOR i = THISFORM.lstSlist4.ListCount TO 1 STEP -1
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform