FYI, it isn't a separate thread. VFP is (mostly) single-threaded. Happy to see my suggestion got some brain power working and you found a solution.
>Craig,
>
> Thanks for the idea, but it didn't quite give the desired result, but it doing so, it appears as when you run something from either the Hotkeys or the menu that it takes off like a seperate thread abd when the code on FormA takes longer then the few lines that tell it to load Form B on the Hotkey or Menu item, I get that effect. I thought about it and found a solution. I use a certain "safe zone" type field on the form and setfocus on it before I load any "FormB" from the menu items or hotkeys. The key is that the "safe field" has little code on the lostfocus or none that sets focus on any other object in FormA. When I do that,, the code runs on FormA completely, then when it hits the safe object it continues which then calls the code to load FormB and all is well.
>
>Ahh.. I see what's happening. You should provide a flag. Before the call to FormB, set a flag that says, "Another form is opening". In the LostFocus, if the flag is set, don't go to the other object on FormA. When FormB closes, clear the flag.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer