Link to home
Start Free TrialLog in
Avatar of Algorithmix
AlgorithmixFlag for United States of America

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Algorithmix

ASKER

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()" ?
I don't see how that could be...
This isn't an MDI app is it?
Is this in a VB6 program, or VBA (such as in Access)?

AW
This is a VB6 app.
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.
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!