Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unloading Form/Closing Application

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
0
0
GB
Hi

I have the following code (cut down version)

Case TotalCorrect = 22
If txtSliderMood.Text = "Good" Then

Agent.MoveTo x:=300, y:=250
Agent.Speak "This program will now close."
Agent.MoveTo x:=0, y:=0
Call Program


End If
End Select

The Call Program line goes Calls a part in the code that has Unload me, in order to unload the form.

However when run the application does not go through the stages/code line by line as above the agent doesn't move of say This program will now close etc the Call Program part seems to execute before the code above it has executed. The form just closes. I ideally want the code above to execute first and then the form unloads or application closes.
 

It sounds like you either need a doevents or the use of the Sleep API. I do not think that the doevents will work because I think the Agent will execute synchronously but you can try it just before the Call Program. If it does not work try the Sleep API. You will find the definition in the API viewer and for info on it you can find it in help. However I would suggest if you need to create a long sleep you may want to use sleep and doevents together in a loop making the interval of sleep short but the number of loops long to get the desired time.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top