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!

Unable to bypass 1 form in set of 3 forms 1

Status
Not open for further replies.

Aseem1234

Programmer
Nov 26, 2003
33
US
Hi,

I have three forms, the main form has a command button, that when clicked loads Form2. In the Init of Form2, there is a call to load Form3. Form 3 is the only modal form. And while form3 is showing, form2 is hidden...

My problem is that I want to go directly back to the main form from form3 when I click cancel. The cancel button on form3 simply says thisform.release () and also sets a proptery of the form and passes it back to the form2. If the user clicks cancel then I try to execute thisform.release () on form2 to get back to the main form...however it just does not disappear!

Any help would be greatly appreciated...

Also I have tried making form2 modal and that caused even more problems! At least right now when I get back to form2, I can press cancel and it will go away...when I make the form modal, even pressing cancel does not work!

Thanks!

AK
 
You haven't shown any code. How are you calling form 3 from form 2? Are you saying DO FORM3 TO Myvariable? Also, how are you calling Form 2 from Form 1? If you've got a dangling reference to Form 2 somewhere, that would explain why it doesn't release.



-BP
 
This is the code for form1: (in command button)

thisform.LockScreen = .T.
do forms\frmPreviewResults
thisform.LockScreen = .F.

Code for form2:(in Init)

thisform.LockScreen = .T.
do forms\frmPrelimCaseDataEntry to thisform.loCollObject
thisform.LockScreen = .F.

If (thisform.loCollObject.ClickType == "Cancel")
thisform.Release ()
else
thisform.Show()
thisform.LoadData ()
EndIf

Code for form3: (in the Unload)

Return thisform.odatacoll


Form2 gets back a collection object with a value called ClickType that tells me if the user clicked cancel or not...form3 just returns the collection object and releases itself.

Thanks,

AK
 
That is exactly what was wrong! THanks a lot BPeisch! Worked perfectly!

AK
 
I had one more question if someone could help me out...if the user clicks OK on form3, then form2 shows with the results...another problem that I am having is that I want form1 to remain locked...

In the above code, it locks form1, but only when form3 is showing...when form2 comes back, the lock is no longer there and the user can just move form2 out of the way and click on the command button again on form1 to open form3! This allows the user to open many form2's if they wanted!

Is there any solution to this?

Thanks

AK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top