Solved

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

Posted on 2014-04-22
2
881 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
ID: 40016895
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
ID: 40047904
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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