We help IT Professionals succeed at work.

VB6, How do I suspend the execution of code in one form until another form is closed?

645 Views
Last Modified: 2008-01-09
After opening from2 from code in form1 I'd like to hold the execution of code in form1 until form2 is closed.
How do I do this?

At the moment in one form I have the following code:

If condition is met then:
Me.MousePointer = vbHourglass
mintWindowState = Me.WindowState
If mfrmNewOrder Is Nothing Then Set mfrmNewOrder = New frmOrder
mfrmNewOrder.SetLoadMode LoadModeChild, cboOrderName.Text, cboOrderNumber.Text, "True"
mdiCDB.LoadChild mfrmNewOrder
mbooChildFormOpen = True
Cancel = True

'WOULD LIKE CODE TO HOLD HERE UNTIL frmLineOrder is closed
End if condition is True
Comment
Watch Question

Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Angellll,
I'd like to use method 1. However I'm getting an unhandled error 371 - "The specified object can't be used as an owner form for Show()" ?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
I don't see how that could be...

Commented:
This isn't an MDI app is it?
Is this in a VB6 program, or VBA (such as in Access)?

AW

Author

Commented:
This is a VB6 app.

Commented:
SYMPTOMS
========

When the MDI child form uses the Show method to open a form, you may
receive the following error:

   Run-time Error '371':
   The specified object can't be used as an owner form for Show().

CAUSE
=====

These errors occur if an MDI child form uses the Show method and specifies
that it owns the form to display. An MDI child form cannot own another
form.

Author

Commented:
OK, I got it. There was other code that was based on form2 being a MDIchild that needed to change also. Thanks for your help!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.