• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Open Modal Form After MDI Load

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()
       MyBase.New()
       Dim frmS as New frmSales
      frmS.ShowDialog()
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.
0
tfewster949
Asked:
tfewster949
1 Solution
 
Farzad AkbarnejadCommented:
Public Sub New()
      MyBase.New()
      frmMDI.Show
      Dim frmS as New frmSales
      frmS.ShowDialog()
End Sub

Startup module for your application must be Sub New()

-FA
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Or like this:

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

~IM
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now