Results 1 to 6 of 6

Thread: Form UNLOAD question - vbFormOwner?? [RESOLVED - always search the FORUM first!]

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    17,882

    Form UNLOAD question - vbFormOwner?? [RESOLVED - always search the FORUM first!]

    I've got a MDI Parent/Child application.

    In it we have a non-child form called frmLookup, where we store "lookup" values in a tree-view, that were used in the child forms.

    We load this form initially from the MDIForm_Load event - but don't show it.

    We fill the tree-view from the child forms.

    We have a QUERYUNLOAD event for this frmLookup that if the unload mode = 0 (vbFormControlMenu), we simply cancel the unload and hide the form. That way the tree-view values are saved.

    I've got a situation where the frmLookup gets put up on the screen by the "second" child form. Now when that "second" child form gets closed, it's triggering an unload mode = 5 (vbFormOwner) event on the frmLookup form.

    I want the MDI PARENT to own this form, so it never leaves memory until the parent is closed.

    How do I do this?

    Thanks...
    Last edited by szlamany; Sep 17th, 2004 at 02:56 PM.

  2. #2

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    17,882
    This is driving me nuts - it appears that when a CHILD form does a MODAL show of this frmLookup form, it becomes the FORM OWNER, so it's unload event wants to unload this form.

    Is there a better way to do this? A way to have the MDIPARENT own the form???

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135
    Why can't you have that TreeView directly on the your MDI form instead - inside some hidden picturebox ???

  4. #4

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    17,882
    Demo on Monday - been using it this was for a long while - we weren't allowing people to close child forms till recently.

    Didn't know about the problem till we started allowing CHILD forms to be closed.

    This stinks.

    They click a HISTORY button on a child form and the MODAL treeview form was appearing - they could move it around if it was blocking something. Click on some name or record that is in the tree-view and the form "spill" those lookup values into the textboxes on the CHILD forms.

    Is there anyway to associate a new FORMOWNER before I HIDE the lookup form??

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    When you show a modal form without specifying an owner, the owner becomes the Form that called the Show method. Makes for some interesting debugging for sure.

    Anyways, everytime you show the form specify the owner as the MDI Form.

    Form1.Show vbModal, MDIForm1

  6. #6

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    17,882
    Thanks - I just searched the forum and found a Marty posting with that same info - from 11/7/2003...

    Originally posted by MartinLiss
    Have you tried

    frmModal.Show vbModal, frmParent

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width