Hello every1, i create a mdiparent form and a form1, all i wanted to do is to close the mdichild form(form1) with a close in the menustrip.
Sorry i cant explain this clearly
When i want to close the opened childform with menustrip (i create a button close in the menustrip)
sorry for this explanation
and help will be appreciated

Recommended Answers

All 10 Replies

Get the (ACTIVE CHILD form instance).Close

sorry cant understant clearly
here's my code, its not working

Private Sub mainmenuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mainmenuToolStripMenuItem.Click
        Me.Show()
        frm2.Dispose()
    End Sub

plz help

Are you working using MDI technique? or just you open form from another??

working on MDI.
can u just tell me how to make mdichild, is it like vb 6.06 just select yes in PROPERTIES or Must write some codes

:O tell you what?, Didn't you tell that you did it and need to know how to close the child form?? or you didn't do it at all!!!!!

Yea I'm a little lost as well - I thought all he needed was
form1.close() or form2.close() or WhateverYourFormsNameIs.Close()

but he needs to code it as well?

sorry i just want to know , my friend told me that u just have to select from PROPERTIES. But i wrote some code for MDI child.

Just confirm this is it possible to make MDI child from another way cause i wrote some code.

Then i cant close the form from menustrip

i try this code as well, but it does not work

Private Sub mainmenuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mainmenuToolStripMenuItem.Click
        Me.Show()
        Me.frm2.Close()
    End Sub

OK. To close the Child window

Me.ActiveMdiChild().Close()
Public Class Form2
  Private Sub Form2_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated
    MsgBox("Test")
    Me.BeginInvoke(New MethodInvoker(AddressOf CloseIt))
  End Sub
  Private Sub CloseIt()
    Me.Close()
  End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.