Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 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 November 12th, 2007, 02:37 PM
Authorized User
 
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Open ChildForm from UserControl (MDIParent)

I developing WinForm using MDIParent (frmParent), one of my childform (frmchild1) have a usercontrol that if the user click a button from usercontrol, it would open up frmchild2 form. How do I code to make this work?

I try couple thing, but it still doesn't work like child2.MdiParent = frmParent.MdiParent;

Please advice.

thanks

 
Old November 13th, 2007, 05:05 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

The best way to do this would be to wire the user control up so rather than load a particular form it simply raises an event. Then frmChild1 can capture the event and it then knows who its MDI parent is and can open the second child form easily.

Alternatively use the UserControl.ParentForm to get the parent form (in this instance frmChild1) and then get its MdiParent property.

/- Sam Judson : Wrox Technical Editor -/
 
Old November 13th, 2007, 05:07 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Oy, why are you asking the same question again. I've just spent time answering this question, then I remembered someone asking on similar, and it was you.

Don't waste my time by asking questions I've already answered, especially when it was you who asked them.

http://p2p.wrox.com/topic.asp?TOPIC_ID=65571

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
FireEvent from userControl dhoyle VB How-To 8 May 14th, 2008 02:51 PM
ObjectDataSource in UserControl Colonel Angus .NET Framework 2.0 0 April 3rd, 2008 10:14 AM
Horizontal scroll bar when childform is maximize juzjess C# 2005 1 November 7th, 2007 05:04 AM
Open ChildForm from another ChildForm in MDIParent juzjess C# 2005 11 October 10th, 2007 03:28 AM
Binding from usercontrol sarah lee ASP.NET 2.0 Basics 1 June 12th, 2007 04:32 AM





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