CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Forms

  1. #1
    Join Date
    Feb 2001
    Posts
    25

    Forms

    I have a MDIForm with children. Each child has a Public function child_close(). How can call the child_close() function of all my childern whenever the MDIForm is closing. Thanks for any help I know this is a simple task.


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Forms


    'this will work only in queryUnload of parent form:
    'if you put this in the unload, the children will be already unloaded.
    private Sub MDIForm_QueryUnload(Cancel as Integer, UnloadMode as Integer)
    Dim frm as Form
    for Each frm In Forms
    If frm.Name <> me.Name then
    If frm.MDIChild = true then
    frm.child_close
    End If
    End If
    next

    End Sub
    'another way: you may put the call to child_close
    'in the unload event of each child




    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Feb 2001
    Posts
    25

    Re: Forms

    Thanks alot.That worked just fine.





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

Featured