Question : How to load a MDI form from a Login form

I need to how do I show a MDI form from the Login screen.

I have tried with this code. But its not working.

                Dim MDIMain As New Form
                MDIMain.MdiParent = Me
                MDIMain.Show()
                Me.Close()

and I have tried this one also.
                Dim MDIMain As New Form
                ''MDIMain.MdiParent = Me
                MDIMain.Show()
                Me.Close()

Its not working. Please help me

Answer : How to load a MDI form from a Login form

Click on Project --> Properties and click on the "View Application Events" button in the bottom right.

Now, across the top of the code editor are two dropdowns.
Change the left dropdown from "(General)", to "(MyApplication Events)".
Next change the right dropdown from "(Declarations)", to "Startup".

Add some code to the autogenerated event so it looks something like this:

        Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
            Dim fl As New frmLogin
            If fl.ShowDialog <> DialogResult.OK Then
                e.Cancel = True ' cause app to close
            End If
            ' otherwise, app continues loading whatever Form the "Startup Object" is set too...
        End Sub

Finally, in "frmLogin", you need to set the DialogResult property of that form (at run-time via code of course!) to indicate whether login was sucessful or not.
Random Solutions  
 
programming4us programming4us