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!

define class as form(release)

Status
Not open for further replies.

LenaS

Technical User
Nov 28, 2000
98
0
0
US
Defined a form within my program as class, program displays the form, I give it input(some dates)and the program runs on but never releases the form. any tricks to this?
 
LenaS

Do you mean the form will not close down?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 

Do you have an exit button that has thisform.release in it?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I have a "GO" cmdbutton which does some other stuff followed by a thisform.release
 
LenaS

Can you post the code that doesn't work?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 

PUBLIC lefffrom,leffto && Book from/to dates & Currency rate
OPEN DATABASE k:\vfp\reinsurance\DATA\mrcdata.DBC SHARED
SET SAFETY OFF && allows overwrite of files
* Prompt for effective dates

oFrmDate = CREATEOBJECT("frmdatepick")
oFrmDate.Show

*Release oFrmDate
public oFrmdatepick
oFrmDatePick = CREATEOBJECT("frmdatepick")
oFrmDatePick.Show
return

**************************************************
*-- Form: frmdatepick
*-- ParentClass: form
*-- BaseClass: form
*:******************************************************************************
*:
*: Class:frmdatepick BaseClass: form
*:
*:******************************************************************************
Define CLASS frmdatepick AS form


Height = 150
Width = 383
DoCreate = .T.
AutoCenter = .T.
BorderStyle = 2
Caption = "Date Range Selection - MidStates ReInsurance"
Closable = .F.
MaxButton = .F.
MinButton = .F.
WindowType = 1
ShowWindow = 1
Name = "frmdatepick"


Add OBJECT Label1 AS label WITH ;
AutoSize = .T., ;
FontName = "MS Sans Serif", ;
FontSize = 8, ;
Caption = "Enter effective dates",;
Height = 19, ;
Left = 50, ;
Top = 15, ;
Width = 79, ;
TabIndex = 1, ;
Name = "Label1"


Add OBJECT LABEL2 AS label WITH ;
AutoSize = .T., ;
FontName = "MS Sans Serif", ;
FontSize = 8, ;
Caption = &quot;\<From:&quot;, ;
Height = 15, ;
Left = 10, ;
Top = 39, ;
Width = 28, ;
TabIndex = 2, ;
Name = &quot;Label2&quot;


Add OBJECT txtefffrom AS textbox WITH ;
FontName = &quot;MS Sans Serif&quot;, ;
FontSize = 8, ;
dateformat = 1,;
datemark = &quot;/&quot;,;
Height = 23, ;
inputMask = &quot;99/99/9999&quot;,;
Left = 49, ;
TabIndex = 3, ;
Top = 35, ;
Width = 72, ;
Name = &quot;txtefffrom&quot;


Add OBJECT Label3 AS label WITH ;
AutoSize = .T., ;
FontName = &quot;MS Sans Serif&quot;, ;
FontSize = 8, ;
Caption = &quot;\<To:&quot;, ;
Height = 15, ;
Left = 10, ;
Top = 70, ;
Width = 18, ;
TabIndex = 5, ;
Name = &quot;Label3&quot;


Add OBJECT txteffto AS textbox WITH ;
FontName = &quot;MS Sans Serif&quot;, ;
FontSize = 8, ;
dateformat = 1,;
datemark = &quot;/&quot;,;
Height = 23, ;
inputMask = &quot;99/99/9999&quot;,;
Left = 49, ;
TabIndex = 4, ;
Top = 66, ;
Width = 72, ;
Name = &quot;txteffto&quot;


Add OBJECT cmdOK AS commandbutton WITH ;
Top = 100, ;
Left = 254, ;
Height = 23, ;
Width = 72, ;
FontName = &quot;MS Sans Serif&quot;, ;
FontSize = 8, ;
Caption = &quot;OK&quot;, ;
Default = .F., ;
TabIndex = 5, ;
Name = &quot;cmdOK&quot;

Procedure cmdOK.Click
Public leffFrom,lEffTo

*!* First, get the values the user entered into the combo boxes.
lEffFrom = ctod(THISFORM.txtEffFrom.value)
lEffTo = ctod(THISFORM.txteffto.value)



SELECT claims.pc,claims.insured,claims.claimant,;
ledger.uw,ROUND(MTON(SUM(ledger.osloss)),2) AS osloss,;
ROUND(MTON(SUM(ledger.osexp)),2) AS osexp,;
ROUND(MTON(SUM(ledger.lospd)),2) AS lospd,;
ROUND(MTON(SUM(ledger.losded)),2) AS losded,;
ROUND(MTON(SUM(ledger.lossir)),2) AS lossir,;
ROUND(MTON(SUM(ledger.exppd)),2) AS exppd,;
ROUND(MTON(SUM(ledger.lospd+ledger.lossalv+ledger.losded+ledger.lossir)),2) AS paidsalv,;
ROUND(MTON(SUM(ledger.lospd+ledger.lossalv+ledger.losded+;
ledger.lossir+ledger.exppd+ledger.osloss+ledger.osexp)),2) AS incurred,;
IIF(ledger.claim<>0,ALLTRIM(STR(claims.claim))+&quot;-&quot;+ PADL(claims.clmsub,2,'0'),SPACE(10)) AS clmno,;
contracts.ctrtype1, (contracts.ctrprefix+alltrim(str(contracts.ctrpoolno))+contracts.subletr) as contract,;
contracts.rptgroup, ctrstatus.ctrsts, claims.claim AS clm7,dtoc(LEFFFROM) AS EFFFROM, dtoc(LEFFTO) AS EFFTO;
FROM mrcdata!claims;
inner JOIN mrcdata!contracts ON;
claims.ctrprefix = contracts.ctrprefix AND;
claims.ctrpoolno = contracts.ctrpoolno AND;
claims.subletr = contracts.subletr AND;
claims.uw = contracts.uw;
LEFT OUTER JOIN mrcdata!ledger ON;
claims.claim = ledger.claim AND;
claims.clmsub = ledger.clmsub;
inner JOIN mrcdata!ctrstatus ON;
contracts.ctrsts = ctrstatus.ctrsts;
WHERE claims.pc=&quot;PF&quot; AND;
ledger.effdate >= lefffrom AND;
ledger.effdate <= leffto;
ORDER BY claims.pc,contracts.ctrtype1,claims.insured,claims.claimant,ledger.uw, clmno;
GROUP BY claims.pc,contracts.ctrtype1,claims.insured,claims.claimant,ledger.uw, clmno;
INTO TABLE k:\vfp\reinsurance\temp\wklyassmdet.DBF
USE
* RUN TO EXCLUDE ASSUMED CLAIMS FROM MATCHING UP IN REPORT
SELECT claims.claim,PADL(claims.clmsub,2,'0') AS clmsub,claims.ctrpoolno,claims.clmsts;
FROM mrcdata!claims;
WHERE ctrprefix=&quot; &quot; AND claims.pc=&quot;PF&quot; AND claims.clmsts <> &quot;I&quot;;
ORDER BY claims.claim, claims.clmsub;
INTO TABLE k:\vfp\reinsurance\temp\wklyassdetsubs.DBF
USE
* PRINT REPORT
oCRApp = createobject(&quot;crystal.crpe.application&quot;)
oRep = oCRApp.openreport(&quot;k:\vfp\reinsurance\reports\30PF.rpt&quot;)
oRep.Printout(.F.)

Thisform.Release

Endproc
Enddefine
remove class
 
oCRApp = createobject(&quot;crystal.crpe.application&quot;)
oRep = oCRApp.openreport(&quot;k:\vfp\reinsurance\reports\30PF.rpt&quot;)
oRep.Printout(.F.)

Thisform.Release


I would guess that the above portion is the culprit. You are not releasing the crystal application. Try releasing the cCRApp before closing the form.




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I don't understand. What do you mean 'not releasing the crystal application'? What should I change about this code to make it 'release the oCrApp'?
 
LenaS

How about :

oCRApp=.null.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
That didn't make a difference, but Thanks.
 
LenaS

It may also be a problem that the Crystal application is not finished its work while you are trying to release the form. As a test I would remove the thisform.release from the command button, create another one and just put thisform.release in it, and once the print out is finished, try and release your form.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I tried that. Made no difference.
 
LenaS

I tried that. Made no difference.

You mean you put a commndbutton on your form and put thisform.release in the click event and your form will not release?



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Lena,

It may be as simple as that: try

RELEASE THISFORM

instead of

THISFORM.Release

Also, you might want to release the public mem. var. associated with that form as well:

RELEASE oForm

HTH.

Regards,

Ilya
 
I have just come across this on a form myself.

They fail to close if you have any public variables created in LOAD or INIT. It also seems to only effect variables pointing to objects not base types.

If you release your variables first it should work.

e.g.

RELEASE oCRApp
ThisForm.Release ( or Release thisform )


Regards


Regards

Michael Hawksworth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top