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

Recall form from another form? 1

Status
Not open for further replies.

sdmi

Programmer
Dec 6, 2001
17
US
In my project, I have to switch between forms by using "BACK" button. I set first form to visible = .F.
So, what code I have to use in second form to make first
form visible = .T. Problem< I don't know how to reference first form when secon form is running.(I can't use &quot;do form&quot; command. Thanks.
 
Hi
Your question i not clear.. in that.. will you have the same sequence..

If the first form is form1, second form is form2..
And if you always call form2 from form1.. then you can make forms WindowState=modal
SO when you release form2, form1 will automaticaly get the focus.

Still even if the windowstate is modeles...
in Form2.. you can say..in the back button... form1.show()

However if the forms order is not going to be same...
then you need to make a PUBLIC array.. let us say aForms. The array shall be incremeted with rows for eveytime you open a form.. and .. then you can scroll thru the array...back and forward.. and show the aforms(n).

Hope this idea helps you. ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
If you are calling the second form with the first, you could pass a reference to the calling form in when you do so. For example, if you have a button that calls it, put this in the click event:
Code:
DO myForm2 with thisform
In the second form, create a property &quot;CalledFrom&quot;, and in the INIT event put:
Code:
lParameters oCallingForm
thisform.CalledFrom=oCallingForm
Then, in the Destroy event of the second form, put this:
Code:
oCallingForm=thisform.CalledFrom
oCallingForm.Show()
This is theoretical, I haven't tried it, but it should work. Hope it helps!
 
HI
The idea shown by chpicker is good and could be easy for you. (Hi chpicker.. it is good idea). There is a little trap in the code
[COLOR=/blue]
Then, in the Destroy event of the second form, put this:

oCallingForm=thisform.CalledFrom
oCallingForm.Show()
[COLOR=/]

oCallingForm.Show() will throw an error, since this is not a form object. You cannot also use..
(oCallingForm).Show()
Neither .. &oCallingForm.Show() will work..

The crack is..
[COLOR=/blue]
&oCallingForm..Show()
[COLOR=/]
This will work. Best of luck :)

ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top