Open Modal Form After MDI Load

Posted on 2004-11-11
Last Modified: 2010-04-17
I'm using VB.NET.

I have an application with 2 forms.

frmMDI is the main MDI Container for the application and is the Start Up object for the application.
frmSales is a second form.

When the application starts, I want the frmMDI to open and then load and open the frmSales as a Modal
form.  To do this, I have the following code in the Sub New() for frmMDI.

Public Sub New()
       Dim frmS as New frmSales
End Sub

The problem is that since I load the frmSales as modal in the Sub New() for frmMDI, frmSales loads first.  Then when I close frmSales, frmMDI continues to load.

How can I have frmMDI load completely and then frmSales load as modal?

Thanks in advance.
Question by:tfewster949
    LVL 14

    Accepted Solution

    Public Sub New()
          Dim frmS as New frmSales
    End Sub

    Startup module for your application must be Sub New()

    LVL 85

    Expert Comment

    by:Mike Tomlinson
    Or like this:

        Private Sub frmMDI_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim frmS As New frmSales
        End Sub


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Create Mobile App Prototypes with Adobe XD

    This is a project-based course: we go through all the steps of creating a prototype from start to finish, using all the tools and features currently available in Adobe XD. You can complete the course in less than a day, plus all project files and fonts are included.

    Suggested Solutions

    Title # Comments Views Activity
    mirrorEnds challenge 6 66
    pre4 challenge 19 75
    seriesUp challenge 7 81
    triangle challenge 4 36
    This is an explanation of a simple data model to help parse a JSON feed
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    737 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

    18 Experts available now in Live!

    Get 1:1 Help Now