Link to home
Start Free TrialLog in
Avatar of BrianBeck
BrianBeck

asked on

"Unable to unload within this context" error (VB)

Dear Gurus
My VB6 app has a number of child forms.  In almost all, the user clicks Cancel to exit and return to the main form.  However, in a new just-created form, I need the code to automatically unload the form at the end of a process.  When I attempt to do this I receive:
"Unable to unload within this context"
I've tried other's suggestions, eg, activating a 50mS timer.  Placing an 'unload me' in that procedure also returned the same effort.  Even calling a separate routine that unloads the form doesn't help.

Can you help please?
Avatar of BrianBeck
BrianBeck

ASKER

i've tried calling a routine in the main form, that invokes a 'child form unload', only to receive the same error.
Note: the last user acrtion is the selection of a drop-down combo box.  From what I've seen, it seems that VB doesn't permit unload routines from combo box event handlers.  But, the event handler calls a separate routine that unloads the form.
Puzzling, and I'm keen to see a solution,
ASKER CERTIFIED SOLUTION
Avatar of raja_ind82
raja_ind82
Flag of India 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
Dear M. Raja
Thanks - brilliantly simple!

Brian