closing mdi child shuts down app

Hellrector

Newcomer
Joined
Aug 8, 2002
Messages
1
Location
The Netherlands
The title discripes the problem that I'm having.

I use the folowing code in my main mdi (parent) window
when clicking a button to open a form

Dim ChildForm As ChildForm = ChildForm.GetInstance()
ChildForm.MdiParent = Me
ChildForm.Show()

The ChildForm has the folowing code

Imports System.ComponentModel
Public Class ChildForm

Public Shared myInstance As ChildForm
If myInstance Is Nothing Then
myInstance = New ChildForm()
End If
Return myInstance
End Function

Do I need to set some properties somewhere or some code to tell the program not to shut down completely when closing the child form?
 
What is that GetInstance stuff and why are you using it?

It looks like something upgraded via the project upgrade wizard. If you want to make a new instance of a form, just use the constructor on it, not some GetInstance function which you've made.
 
Dunno how helpful this is going to be now as it's a while after your question:

C#:
childForm = new myChildForm();
childForm.MdiParent = this;
childForm.Show();

Put this in your MDI Parent form.
 
Back
Top