Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stopping a process
Message
 
 
To
01/03/2011 14:35:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01029879
Message ID:
01502272
Views:
97
I think I figured this out, although it caused me quite a grief.

My latest code is this one
try

   for lnI = _screen.formcount to 1 step - 1
      lnI = _screen.formcount
      if m.lnI > 0
         loForm = _screen.forms[m.lnI]
         oAppObj.write_log('Releasing form ' + m.loForm.name,program(),'2')
         if vartype(m.loForm) = 'O' and pemstatus(m.loForm,'Release',5)
            loForm.release()
         endif
      endif
   next

catch to loError
   oAppObj.write_log('Error occurred in the CleanUp procedure: ' + loError.message,program(),'1')
endtry
I think what was happening is that one form release caused another form release as well and therefore the second call in the loop caused the error.


>>>Why don't you simply step through the code with the debugger?
>>>
>>Tore,
>>
>>Do you see where is a bug in this small piece of code
>>
>>
>> 
>>   FOR lnI = _screen.FormCount TO 1 STEP - 1
>>   			oAppObj.write_log('Releasing form ' + _screen.Forms[m.lnI].name,program(),'2')
>>   			IF TYPE('_screen.Forms[m.lni]') = 'O'
>>	       _screen.Forms[m.lnI].Release()
>>	       endif
>>   NEXT
>>
>>why does it generate Forms is not an object ?
>
>Maybe there is some dependencies between the forms. Have you checked whether you get this error for all values of lnI or just one value?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform