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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close an active form 2

Status
Not open for further replies.

psalyer

Technical User
Jun 20, 2001
30
US
Hi,
What is the best way to close an active form that completely deactives it and removes it from view (not just hidden).
Thanks
 
Just release it (from memory) by issuing a THISFORM.RELEASE().

Depending on the actions you want to take, you can make it as robust as you want it (checking for unsaved data, asking the user to save or cancel etc.) but in essence a form is just an object that is in memory and is best released from memory.

HTH,
Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
Hi Weedz
I put that code in the lostfocus event and it did nothing. Where is the best place on the form to put it? What I am try to do is completely remove the form once I click on my find button on the form. My find button calls a PRG file that looks for the records I'm trying to find. Then once I find the records, the prg recalls the for with a do form statement.
 
So let me get this clear:
1. Do form
2. Click on find button on form
3. Prg oes some action
4. As far as I understand, the process should return to the place from where you called your prg ? Presumably the click event of your find button.
5. So once you found you data, issue a THISFORM.RELEASE()

Something like:

PROCEDURE cmdFind.Click
DODEFAULT()
=FindMyData()
THISFORM.RELEASE()
ENDPROC

HTH, Weedz (Wietze Veld)
My private project:And especially for VFP rookies:
 
Yes, that will work fine, but won't the form still be on the screen while FindMyData() is running?

If so, try:

PROCEDURE cmdFind.Click
DODEFAULT()
THISFORM.Visible = .F.
=FindMyData()
THISFORM.RELEASE()
ENDPROC

Stewart
 
Thanks you all. That finally fixed it! I really appreciate the help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top