Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
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 November 16th, 2005, 10:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default MDI Application and Sharing Objects

I have searched for topics on this question and what I found only confused me. Maybe I need a simple explanation.

I have a small MDI app, with 3 or 4 child forms. I am using a module page to share a class across the forms. i.e., my class is declared as "Public cProf as New Profile" in the module. I couldn't think of another way to share the class properties/methods across forms, but is using the module the best way to do this?

First Issue:
On the main mdi form, I have a statusbar. I need to set the text of the panels from the child forms. When I try to set the Text from the module it doesn't seem to work. How can I do this from the child forms and/or from the module? The method I use below for listboxes doesn't seem to work for my statusbar...

Second Issue:
One of the child forms has list boxes that need to be updated depending on a user selection in another child form. The only way I could successfully do this was to declare the form with the listbox as Public in my module. This doesn't seem quite right to me...???

-------------------------
Beware of programmers with screwdrivers...
__________________
-------------------------
Beware of programmers with screwdrivers...
 
Old November 18th, 2005, 07:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

For First issue i think that MDI childs can access the elements of the main form through their mdiparent property (given that this property is set properly). I belive u just have to cast the property to the type of your mdi parent form and then u can access all the elements of the parent form.

For the second issue. U can delegate this work to a common function in your parent form. call this function from your child forms and indicate in the function parameters as to what child to convey the message to. Let this function call the relevent functions in the child class to perform rest of the task.


Regards
Ankur Verma
 
Old November 18th, 2005, 10:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default

Well...I sort of got it to work, but not in the form I am still using the Module.

In my module I have:
Code:
Public mdiM As New MyMDIParentForm
Then I can use this object in my child forms.

I still haven't figured out exactly how to do this without a Module. The MdiParent property of my child forms doesn't expose any objects of the parent-I must be missing something there...

-------------------------
Beware of programmers with screwdrivers...
 
Old November 18th, 2005, 04:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

If u would see the type of MdiParent property, it is of type Form, so it'll show the functions and properties of form class only. It will not show any of the things you have defined in the Mdi Parent Form of your project. Thats why i mentioned the that you'll have to cast the property to your projects MdiParent Form before trying to access the elements specific to your MDI Parent Form class.

Regards
Ankur Verma
 
Old November 18th, 2005, 05:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default

Thanks Ankur...I think I got it...I'll post my code later...

-------------------------
Beware of programmers with screwdrivers...





Similar Threads
Thread Thread Starter Forum Replies Last Post
sharing variables throughtout the jsp application kanoorani JSP Basics 3 April 23rd, 2007 11:36 PM
MDI application!!!!! angelboy C# 2005 0 February 23rd, 2007 12:36 PM
MDI application !!!!! angelboy C# 2005 0 February 7th, 2007 06:12 AM
MDI Application phillipjones1988 C# 2005 0 December 3rd, 2006 12:56 AM
MDI Application dayaananthanm VB How-To 1 August 24th, 2006 04:39 PM





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