Solved

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

Posted on 2014-04-22
2
940 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

622 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