Wrox Programmer Forums
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 30th, 2005, 05:07 PM
Registered User
 
Join Date: Mar 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default MDI Help Needed

I have a parent form called 'MainForm' and two other children forms (switchboard and newcustomer). I created a menubar for 'MainForm' that includes a 'SwitchBoard' item. When I run the application and click the 'SwitchBoard' menu at the top, my switchboard appears , as a child, as it should.

Now, the switchboard itself contains a button called 'New Customer'. When I click this button, I want the new customer dialog to appear as a child of 'MainForm'.

The following event handler code is inside my SwitchBoard.cs file:

private void ncButton_Click(object sender, System.EventArgs e)
{
  NewCustomer ncDialog = new NewCustomer();
  MainForm parentForm = new MainForm();
  ncDialog.MdiParent = parentForm;
  ncDialog.Show();
}

But when the button is clicked nothing happens.

How can I get my new customer dialog to show as a child of 'MainForm'?

Thanks in advance!

 
Old March 30th, 2005, 05:23 PM
Registered User
 
Join Date: Mar 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Never mind guys, I figured it out.

private void ncButton_Click(object sender, System.EventArgs e)
{
  NewCustomer ncDialog = new NewCustomer();
  ncDialog.MdiParent = this.MdiParent;
  ncDialog.Show();
}

Thanks anyway! :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying MDI Child Form Menus with MDI Parent ashu_from_india Pro VB 6 3 June 10th, 2008 11:01 PM
MDI & MDI Child Forms Menu's in VB2005 yulyos Visual Studio 2005 0 September 7th, 2007 09:49 AM
Controlling MDI child form from MDI parent panel LuxCoder Pro Visual Basic 2005 1 May 25th, 2007 12:20 PM
Controlling MDI child form from MDI parent panel LuxCoder VB.NET 2002/2003 Basics 7 April 11th, 2007 02:38 PM
Controlling MDI child form from MDI parent panel LuxCoder Visual Basic 2005 Basics 2 April 9th, 2007 03:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.