Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Opening already created form in MDIParent in VB.NET
 

Opening already created form in MDIParent in VB.NET

Hi, Can any1 tell me how to open an already created form in MDIParent.......I have searched many times, many days, but all in vain....i'm getting solutions to create & open a new form....but what i want is that i have created a from named "Customer_Master" & I hva default MDIParent form. Now, when i click on the sub-menu in menubar in MDIParent, i want the "Customer_Master" form to open alligned at center of MDIParent form, with the Customer_Master form (child form) having only the close option, no maximine and minimize options present at the top-right corner ofall forms......please please please do rep me as soon as possible......i need it as urgently as possible....I hv tried all of my best ways &now finally asking all of u.....

Thank u in advance.....

AmrutaVK  Friday, July 03, 2009 7:19 PM
    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
        Dim cForm As New Customer_Master
        cForm.MaximizeBox = False
        cForm.MinimizeBox = False
        cForm.StartPosition = FormStartPosition.CenterScreen
        cForm.MdiParent = Me
        cForm.Show()
    End Sub

Thanks

- Omie
Someone makes my heart skip a clock cycle !
Omie  Friday, July 03, 2009 8:13 PM
    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
        Dim cForm As New Customer_Master
        cForm.MaximizeBox = False
        cForm.MinimizeBox = False
        cForm.StartPosition = FormStartPosition.CenterScreen
        cForm.MdiParent = Me
        cForm.Show()
    End Sub

Thanks

- Omie
Someone makes my heart skip a clock cycle !
Omie  Friday, July 03, 2009 8:13 PM
Hi AmrutaVK,

Based on my understanding, you have shown that form not as MDI child form. Then you want to click menu item to show it into the MDIParent. You don't want to create a new form but move the current one into MDIParent. Am I right? If I misunderstood you, please feel free to tell me.

So I think Omie's code is partly correct. Do not call Dim cForm As New Customer_Master, just
Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
cForm.MaximizeBox = False
cForm.MinimizeBox = False
cForm.StartPosition = FormStartPosition.CenterScreen
cForm.MdiParent = Me
cForm.Show()
End Sub
will be ok. The current form won't close and it will "jump" into the MDIParent.

Thanks for Omie's code and warmly help.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Tuesday, July 07, 2009 3:09 AM

You can use google to search for other answers

Custom Search

More Threads

• DateTimePicker: Preventing Value change event when switching months in the pop-up calendar?
• Toolstrip buttons
• AutoSize for DatagridView
• User control doubt
• Visual Studio IDE
• Need to determine the last control in ControlCollection in custom Designer
• Button Click not firing after Validation event
• Where are windows forms controls icons stored?
• Custom textbox designer
• Error in designer with inherited usercontrols