Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removeobject skips some objects
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00835738
Message ID:
00835781
Views:
10
Joe,

You could try something like this:
LOCAL i
WITH ThisForm.cntButtons
    FOR i = .Controlcount TO 1 Step -1
	.RemoveObject(.Controls[i].Name)
    ENDFOR
ENDWITH
Cheers,

Zoran

>I call this code during the form init and occasionally to refresh the buttons on a form. The second time it only removes the MenuButtons and not the ButtonTimers which causes a crash when adding the timers back in. What am I doing wrong?
>
>
>FOR EACH loAppControl IN thisform.cntButtons.objects
>	thisform.cntButtons.RemoveObject(loAppControl.name)
>ENDFOR
>
>SELECT vapps
>REQUERY()
>SCAN FOR vapps.lactive
>	NewButton='cmd'+ALLTRIM(vapps.cObjName)
>	thisform.cntButtons.addobject(NewButton,'MenuButton')
>	
>	NewTimer='tmr'+ALLTRIM(vapps.cObjName)
>	thisform.cntButtons.AddObject(NewTimer,'ButtonTimer')
>endscan
>
Previous
Reply
Map
View

Click here to load this message in the networking platform