Hey guys,

I have simple menu item that opens a form upon click.
The problem is menu item opens a new instance of the same form every time I click on it.
I want it so when the form assigned to the menu item is open then the code will ignore the request to open another form.
Please help

Private Sub miReportProblem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miReportProblem.Click


            Dim NewMDIChild As New frmReportProblem()
            NewMDIChild.MdiParent = Me
            NewMDIChild.Show()

    End Sub

Hey guys,

I have simple menu item that opens a form upon click.
The problem is menu item opens a new instance of the same form every time I click on it.
I want it so when the form assigned to the menu item is open then the code will ignore the request to open another form.
Please help

Private Sub miReportProblem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miReportProblem.Click


            Dim NewMDIChild As New frmReportProblem()
            NewMDIChild.MdiParent = Me
            NewMDIChild.Show()

    End Sub

http://support.microsoft.com/kb/210248

Do it this way:

Private NewMDIChild As frmReportProblem
Private Sub miReportProblem_Click(sender As System.Object, e As System.EventArgs)
	If NewMDIChild Is Nothing Then
		NewMDIChild = New frmReportProblem()
		NewMDIChild.MdiParent = Me
		NewMDIChild.Show()
	End If
End Sub