Solved

VB.NET Form Modal vs. Non-modal vs. Owner

Posted on 2014-04-22
2
852 Views
Last Modified: 2014-05-07
I have Form1 and Form2 which should be accessible to the user independently.  A button on Form1 will open Form1A (should be modal to Form1 only) and open Form2 (accessible while Form1A is open):
        Form2.Show() 'Should be independent from Form1 and Form2
        Using frm As New Form1A
            frm.Owner = Me
            frm.ShowDialog()
            'When Form1A closed, do something with user entered data
        End Using 

Open in new window


I have tried using a mixture of owner and show vs. showdialog, but if the Form1A is modal, it also blocks access to Form2.  I need for the user to be able access both Form1A and Form2 at the same time.   When open, Form1A should of course prevent access to Form1.  I realize that I could probable add code to Form1A in the FormClosing event, but I also want the code to be cleaner, and Form1A could be opened from various other forms as well.  Any thoughts on how to accomplish this?
0
Comment
Question by:eeyo
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
Comment Utility
A form is modal at the application level, so there is not way to do what you want from inside the same application.

You could however hide or disable Form1 while Form1A is on the screen, something like the following:

Me.Hide
Form1A.Show
Form2.Show
Me.Show

or

Me.Enabled=False
Form1A.Show
Form2.Show
Me.Enabled=True

The only problem with Enabled is that Form1A will flash a few time if the user clicks on Form1 while it is disabled. There might be a way to prevent that, but I do not have time to look into that.
0
 

Author Comment

by:eeyo
Comment Utility
I was hoping for a way out, but I will have to accept that modal is at the application level.  JamesBurger's suggestion is a reasonable start.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now