473,699 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MDI Parent call MID Child events, methods

Hi all
What need to be done to get the MDI parent call his MDI children Events,
methods

Thanks in advance
/WS
Nov 16 '05 #1
8 3758
Hi,

If you want MDI parent call its child method then give that method
a "public" accesor.

I'm not really sure what you want to call child event for?
Don't you want to add handle to that child's event?
If so, then i don't see any problem, e.g. add event handler in child
initializing block.

If i missed somethig then don't affraid to feedback.

regards
Marcin
Hi all
What need to be done to get the MDI parent call his MDI children Events,
methods

Thanks in advance
/WS

Nov 16 '05 #2
Yes, will be great:
Would you like to explain more detail about how to define this event,
and to work with

Thanks, regards
/WS

"Marcin Grzębski" <mg*******@taxu ssi.spamstop.co m.spamstop.pl> wrote in
message news:ct******** ***@mamut1.aste r.pl...
Hi,

If you want MDI parent call its child method then give that method
a "public" accesor.

I'm not really sure what you want to call child event for?
Don't you want to add handle to that child's event?
If so, then i don't see any problem, e.g. add event handler in child
initializing block.

If i missed somethig then don't affraid to feedback.

regards
Marcin
Hi all
What need to be done to get the MDI parent call his MDI children Events,
methods

Thanks in advance
/WS

Nov 16 '05 #3

"Waleed Seada" <ds**********@h otmail.com> schrieb im Newsbeitrag
news:eR******** ******@TK2MSFTN GP14.phx.gbl...
Hi all
What need to be done to get the MDI parent call his MDI children Events,
methods

Thanks in advance
/WS


Maybe you mean such like this:
MdiClientForm f = new MdiClientForm() ;
f.Show();

// Add Handler when you create a new child form (for example closed handler)
f.Closed += new EventHandler(Md iClientForm_Clo sed);
// Handle Events here
private void MdiClientForm_C losed(object sender, System.EventArg s e)
{
}

Nov 16 '05 #4
If you want to call methods or respond to events that are specific to
the children form classes (outside of the base set for Forms) it may
help to define an abstract class for the children to inherit from or an
interface for them to mix in. This way you can iterate through the
children and to call methods or create more generic routines for
assigning event handlers to new child forms as they are created at
runtime. I don't know if this is exactly what you are trying to do,
but if it is I hope it helps.

-Dan Shanyfelt

Nov 16 '05 #5
I understand what "Torsten" said, Could you illustrate more detail, please
Thanks
Waleed Seada

<da************ *@yahoo.com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
If you want to call methods or respond to events that are specific to
the children form classes (outside of the base set for Forms) it may
help to define an abstract class for the children to inherit from or an
interface for them to mix in. This way you can iterate through the
children and to call methods or create more generic routines for
assigning event handlers to new child forms as they are created at
runtime. I don't know if this is exactly what you are trying to do,
but if it is I hope it helps.

-Dan Shanyfelt

Nov 16 '05 #6
Hi,

You should explain what you want to achieve, first.
If you don't know how to define your own event then you should
read some docs or C# books to learn how it works.

Marcin
Yes, will be great:
Would you like to explain more detail about how to define this event,
and to work with

Thanks, regards
/WS

Nov 16 '05 #7
I already did, what I want to do is to implement what I have read, and with
examples, I will be able to decide
I want to create a custom treeview control, then add some events and methods
for it to work

How simply by defining one method and one event I can get it to work, can
you help me in this please

Thanks for your help
Waleed Seada
"Marcin Grzębski" <mg*******@taxu ssi.spamstop.co m.spamstop.pl> wrote in
message news:ct******** ***@mamut1.aste r.pl...
Hi,

You should explain what you want to achieve, first.
If you don't know how to define your own event then you should
read some docs or C# books to learn how it works.

Marcin
Yes, will be great:
Would you like to explain more detail about how to define this event,
and to work with

Thanks, regards
/WS

Nov 16 '05 #8
-to make the "abstract" form:

public class abForm : System.Windows. Forms.Form

//public abstract class abForm : System.Windows. Forms.Form
//making this a real abstract class messes with the form designer but
will still work

public void MakeRed()
{
this.BackColor = System.Drawing. Color.Red;
}

-to make the child forms

public class F2 : abForm
public class F3 : abForm

-in the mdi form
private void mdi_Load(object sender, System.EventArg s e)
{
F2 ff2 = new F2();
ff2.MdiParent = this;
ff2.Show();
F3 ff3 = new F3();
ff3.MdiParent = this;
ff3.Show();
}

private void button1_Click(o bject sender, System.EventArg s e)
{
foreach (Form f in this.MdiChildre n)
{
((abForm) f).MakeRed();
}
}

The same principle would apply to events. If there is a way to make
the abstract form in a cleaner way (still allowing for the abstract
keyword without breaking the designer for the forms that inherit from
it), I hope one of the experts on this board will explain. The other
option would be to create an interface that specifies the MakeRed
method. The only reason to make the "abstract" form is that you don't
have to write the code inside MakeRed for every inherited form.
-Dan Shanyfelt

Nov 16 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
20393
by: Filiz Duman | last post by:
Is it possible to call a javascript function based in the parent window from the child window ? I do open a pop up window from the parent window with: newwindow = window.open (...) and assign a value from the child window to the parent window text field: opener.document.forms.elements.value = valuename;
9
5121
by: Martin Herbert Dietze | last post by:
Hello, I would like to implement a callback mechanism in which a child class registers some methods with particular signatures which would then be called in a parent class method. In half-code this should in the end look like this: In the child class:
3
9700
by: Maheshkumar.R | last post by:
Hi groups, How i can command over the MDI CHIlD forms created dynamically at runtime from PARENT. Let say, i have generated 5 mdichild forms, but i want to work with child form1 from MDI parent menu functions. if i select draw line in MDI parent, the line should be drawn in current active child..any URLS for this or guide me to achieve this communication... -- Mähésh Kumär. R
1
11574
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
10
4017
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
3
2742
by: zacks | last post by:
Forgive me if this has been already asked an answered, I did do a search both here and in VS2005 Help, but I can't find the answer to my question. I am developing an MDI application that is a speciality XML file editor, used to create and edit a special XML file. It is an MDI app since I want users to be able to have multiple XML files open at the same time. The parent form has the usual Menu bar with a File menu that has the
0
1349
by: uupi_duu | last post by:
Hello, I have a parent class which creates and uses child class. Child class use it's own methods for different tasks. If an error occurs in child classes methods I would like to inform it to parent class using Events/Delegates. What would be a nicest way to child to communicate to parent using Events or Delegates? Sample would be nice,
4
6053
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase this is all very difficult to explain in words, please bear with me as I endevour to explain what it is I am trying to do. It would be helpful if I could attach a graphics file to this posting that would help explain what it is I'm trying to achieve...
3
3700
by: O.B. | last post by:
I have a form that shows another child form using the Show() operation. Since the child is modaless, I would like the option that when I click anywhere on the parent form that the parent form comes in front of the child. I added a callback in the parent form to call BringToFront() when I selected anywhere in the parent form, but it didn't work. Is there an option that I can specify in the child form to allow for this behavior?
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8908
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.