The delay and the message still sounds as if you are opening the window in some sort of loop. To see if this is the case, why not put the following code into the load of the form class
Local lnX,lcCaller
For lnX = 2 To 1000
If Empty(Sys(16,lnX))
Exit
EndIf
Next
lnX = lnX - 2
StrToFile(Chr(13) + "Form " + this.Class + " called at " + Transform(Datetime()) + " by " + Sys(16,lnX),"openlog",.t.)
If you run a test using this code and there is only one entry in openlog then the problem is not a loop. if the file is full of entries then either the calling routine contains a loop or it is being called amny times.
Incidentally, are your form classes modal? if they are modeless then showing the form will not halt the parent code and it could go on to do other things (like starting the form again)
Hope this is some help, at least to eliminate my idea.
Best regards
Andrew
>My application give the runtime error 'Too many window open' after user
>use the menu to open the form and click the x button to close it. If
>we repeat it by opening and close the form, it will give the error.
>
>My form is all created using classes.
>Any ideal how to close all the classes as I suspect my form is not close properly.
>
>>Sounds as if you have got into some sort of loop. What code is run to load the form when the menu item is chosen?
>>
>>Andrew
>>
>>>Hi,
>>>
>>>My company application is created using VFP6 with SP5.
>>>All the form is created using classes.
>>>
>>>However, when user click the menu to activate which form,
>>>after some time, it will give error of "Too many windows open"
>>>
>>>How can I effective unload the individual form classes
>>>before opening the other form classess ?
>>>
>>>Any help or comment is very much appreciated. Thank you