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!

form.release() question

Status
Not open for further replies.

R17

Programmer
Jan 20, 2003
267
PH

i have two forms, form1 and form2. my form1 contains a command button with click event "DO FORM form2".

in my form 2 i have an option group and 2 command buttons "OK" and "CANCEL".

i have this in my click event for "OK".

Thisform.Release() && release my form2
Thisform.Savemode() && method i created in form1

whenever i run my form, i get an error that it cannot find my method savemode.

my question is, shouldn't my form1 be "activated" after i release my second form? if i do another DO FORM form1 after Thisform.Release(), i'm having 2 instances of my form, that is i have to click "X" twice to close the form.

pls enlighten me on this matter..



 
It sounds like you have the thisform.savemode() being called from your form2 that you have just released...also, I am thinking that savemode() is a method of form1 not form2 so calling it from inside form2 doesn't do you any good since the thisform is form2, not form1.

Solution---
Put the follwoing in your command button on form1:

do form2 to lOkclicked

if lokclicked
thisform.savemode()
endif


In the form2 load event:
Public lReturn
lReturn = .f.


In the form2 ok button click event:
lReturn = .t.

In the form2 unload event

Return(lReturn) Slighthaze = NULL
 
HI

You can refer form1 in form2.. with object reference.. i.e.
Form1.SaveMode()

In order to make this work..
DO FORM form1 NAME form1

In form2.. you can refer form1 with reference Form1.SaveMode instead of ThisForm.SaveMode()

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
R17,

You may also have a conflict with the form name. When you create the first form it's automatically named "FORM1". When you create the second form it's also named "FORM1". I always change my form names - i.e. "FRM_ADD_CUSTOMER" and "FRM_PRINT_HISTORY". It also makes things easier to debug because you'll know exactly which form caused the problem.

Steve
 
Hi you could pass the form as an object reference eg:

do form2 with this

in the init of form2

lparam ;
localler

this.caller_o = localler

in the release:
local ;
localler

localler = this.caller_o
localler.savemode()

 

thanks!

i figured it out myself, i did the same thing as ramani. but i'll try all your suggestions. thanks again!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top