• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

Modal Forms Are Not Closed, When The Main Application Is Closed

Hi All,

I have few modal forms in my application. For Some Reasons(which are necessary for my application), I have used

<form>.show                  instead of
<form>.show 1
But the problem is that in such a case, if the user opens such form and forgget to close them and closes the main application these forms remain there unclosed.

What can be the solution that as soon I closes the main application (all forms opened including Modal opened with <.show> also closes).

Regards,
Om
0
omsudha
Asked:
omsudha
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
???  Your post seems to have conflicting information in it...

If you have shown the forms modally, then you can't interact with the main form until the modal form is closed.

This line:   (which you say you're using)

    <form>.Show

does NOT show a form modally.  

This does show a form modally:

    <form>.Show vbModal



You could try code like this in your main form to make all forms unload when it is closed:

    Private Sub Form_Unload(Cancel As Integer)
        Dim frm As Form
        For Each frm In Forms
            Unload frm
        Next frm
    End Sub
0
 
omsudhaAuthor Commented:
Thanks Idle_Mind,
Let me clear first-

Those are modal forms with their MDIChild is False in Design, if that value is True the form would have closed auto when the main application is closed.

But the above form I have showed using
.Show instead of .show 1(vbModal)
If 2nd is the case I would not be able to interact with the main application till the form is
close, but since I have used <form>.show and also its MDIChild is False, I was facing the above problem.

However in any case your code snippet will solve my problem.
I have one more question if you can have a look and see at-

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21873373.html

Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now