?
Solved

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

Posted on 2014-04-22
2
Medium Priority
?
957 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

719 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