Results 1 to 6 of 6

Thread: MDI program and child forms

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Nottingham
    Posts
    41

    MDI program and child forms

    Hi,

    I have an MDI project and it allows the user to show any number of child forms. However, when about 3 children are showing, the child windows go through a crazy loop as if they are all fighting to be the top window. After about 10 seconds, the settle down but obviously it shouldn't happen. I'm calling the forms in the MDI form like:

    Private Sub cmdResellerDetails_Click()
    frmResellers.Show
    End Sub

    Private Sub cmdProfitSell_Click()
    frmProfitSell.Show
    End Sub


    Where frmResellers and frmProfitSell are both child forms. Does anyone know why my windows are going crazy?

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    I guess the quetion is: what are the child forms doing when they load?

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Nottingham
    Posts
    41
    For example, I want form2 to show, but form1 is already visible. When form2 loads, form1 will grab the focus, then form2 then form1 then form2 repeat ad finitum (well for a while anyway )

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I think he means code wise, what are the forms doing when they load? What is in their Form_Load?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Nottingham
    Posts
    41
    Oh sorry, my bad

    One of the forms loads at the beginning of the program

    One of the forms does a db query and then moves controls based on the width of the program

    One of the forms moves controls based on the width of the program

    Another thing is that in form_resize on all 3 forms, I have:

    me.windowstate = 2

    Could that be causing the probems?
    Should I change it to:

    if not (me.windowstate = 2) then
    me.windowstate = 2
    end if

  6. #6
    New Member
    Join Date
    Mar 2002
    Posts
    2
    I had a similar problem. In one form, I was referring to a control on a different child form. Just referring to the control on the other form caused the other form to be loaded and that started an endless loop.

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