Results 1 to 3 of 3

Thread: MsgBox changes windows overlaying - HELP

  1. #1
    Guest
    I am having form that puts another form overlayed on top. At this time the first form is disabled, but visible partially underneath. When I display the MsgBox on the second form, my program overlies the first form over the second and then shows MsgBox on top of the first form. What I want is that the MsgBox is shown over the second form.

    To sumarise, I have:

    Form1 (underneath) --> SmallerForm2 (on top)

    When SmallerForm2 displays Msgbox, I want:

    Form1 (underneath) --> SmallerForm2 (on top) -->MsgBox (on top of SmallerForm2)

    But, what I get instead is:

    SmallerForm2 (underneath) --> Form1 (on top) -->MsgBox (on top of Form1)


    Code in Form1:
    ---------------
    'more than one station found, now we have to show it in the list

    Form1.Enabled = False
    SmallerForm2.Show

    Code in SmallerForm2:
    ---------------------
    'We must choose one entry from the list

    If Module1.ListChoice = 0 Then
    MsgBox "You must choose an entry from the list", vbOKOnly + vbExclamation, "Messagio"
    End If

    etc...

    The Form1 comes on top of SmallerForm2 during the execution of MsgBox statement and once the user presses <OK>, it all returns in the right place, so obviously MsgBox does something to it. How do I stop it because I want SmallerForm2 visible underneath MsgBox.

    Thanks.

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196
    I'm not 100% sure if this will work, and it might have some other sideeffects but:

    Code:
    'Change:
    SmallerForm2.Show
    
    'To:
    SmallerForm2.Show vbModal
    This will always show SmallerForm2 over the top of Form1. This might help your messagebox problem but be aware that if you show the form vbModally you can never get back to Form1 as long as SmallerForm2 is still being viewed (showed - when you do SmallerForm2.Hide, or .Unload etc then Form1 will be shown again)

    Just try it and see what happens,


  3. #3
    Guest
    I played around and yes, it does what I want, thanks.

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