MDI Child form events .... could not be raised :(

  • Thread starter Thread starter CJack
  • Start date Start date
C

CJack

hy,
I have an mdi application, i create a child form and I want to know
when a button is pressed while that child form is loaded.
I have this code:

private void frmTestBaby_KeyUp(object sender, System.EventArgs e)
{
MessageBox.Show("keyboard button pressed!");
}
Following is the code to load the frmTestBaby

private void menuItem2_Click(object sender, System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

Can someone help out to how to get the event raised KeyUp for the
child form frmTestBaby.
Please note that I have also tried activating the child form after
frmTestBaby.Show(); but it did not work.

regards
 
Hi,

If I understand you correctly, you want to raise an event
from the child form so the parent form can receive the
event. If that's what you want, here's what you can try.

1. Add the event handler to the frmTestParent form:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();

frmTestBaby.KeyUp += new
System.Windows.Forms.KeyEventHandler
(this.frmTestBaby_KeyUp);
}

2. Add the code to the frmTestParent form to handle the
event.

private void frmTestBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox("Event Receive from Parent: KeyUp was "
e.KeyCode);
}

This will only work if the frmTestBaby form does not have
a control (ie: text box) that will receive the KeyUp
event before the form. Otherwise, the control has to
raise the event so the form will receive it.

Hope this helps,
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"
 
Thanks Thomas, I tried the code but still it did not work :( any other
idea please share with me
 
You have to make sure the controls inside frmTestBaby
form do not receive the KeyUp event first. This may not
be possible. Also, clicking on the button does not raise
a KeyUp event.

I read your original question again. If you just want
the parent to receive an event when the child form is
loaded, you should have the parent capture the
frmTestBaby.Load event instead of the KeyUp event.

Try the following code:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.Load += new System.EventHandler
(this.frmTestBaby_Load);
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

private void frmTestBaby_Load(object sender,
System.EventArgs e)
{
MessageBox.Show("child form loaded");
}

Please let me know if I've misunderstood your question
again. I hope this will point you to the right path.

Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"

-----Original Message-----
Thanks Thomas, I tried the code but still it did not work :( any other
idea please share with me

"Thomas Ha [MSFT]" <[email protected]> wrote in
message news: said:
Hi,

If I understand you correctly, you want to raise an event
from the child form so the parent form can receive the
event. If that's what you want, here's what you can try.

1. Add the event handler to the frmTestParent form:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();

frmTestBaby.KeyUp += new
System.Windows.Forms.KeyEventHandler
(this.frmTestBaby_KeyUp);
}

2. Add the code to the frmTestParent form to handle the
event.

private void frmTestBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox("Event Receive from Parent: KeyUp was "
e.KeyCode);
}

This will only work if the frmTestBaby form does not have
a control (ie: text box) that will receive the KeyUp
event before the form. Otherwise, the control has to
raise the event so the form will receive it.

Hope this helps,
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"


I
want to know child
form after
.
 
<<< I need to raise event on child form keyup >>>.
my code is not working that i mentioned in first post. I also tried ur
approach for the parent form to recieve the event keyup and raise it,
this is also not working. just to check for events in child forms, i
tried to define a mouse click event on the child form, it is perfectly
working.
I dnt understand that why keyup event is not working on child form of
an mdi application. is it a limitation on c#?
could u plz help.
regards
Arif
Thomas Ha said:
You have to make sure the controls inside frmTestBaby
form do not receive the KeyUp event first. This may not
be possible. Also, clicking on the button does not raise
a KeyUp event.

I read your original question again. If you just want
the parent to receive an event when the child form is
loaded, you should have the parent capture the
frmTestBaby.Load event instead of the KeyUp event.

Try the following code:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.Load += new System.EventHandler
(this.frmTestBaby_Load);
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

private void frmTestBaby_Load(object sender,
System.EventArgs e)
{
MessageBox.Show("child form loaded");
}

Please let me know if I've misunderstood your question
again. I hope this will point you to the right path.

Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"

-----Original Message-----
Thanks Thomas, I tried the code but still it did not work :( any other
idea please share with me

"Thomas Ha [MSFT]" <[email protected]> wrote in
message news: said:
Hi,

If I understand you correctly, you want to raise an event
from the child form so the parent form can receive the
event. If that's what you want, here's what you can try.

1. Add the event handler to the frmTestParent form:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();

frmTestBaby.KeyUp += new
System.Windows.Forms.KeyEventHandler
(this.frmTestBaby_KeyUp);
}

2. Add the code to the frmTestParent form to handle the
event.

private void frmTestBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox("Event Receive from Parent: KeyUp was "
e.KeyCode);
}

This will only work if the frmTestBaby form does not have
a control (ie: text box) that will receive the KeyUp
event before the form. Otherwise, the control has to
raise the event so the form will receive it.

Hope this helps,
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"



-----Original Message-----
hy,
I have an mdi application, i create a child form and
I
want to knowchild
form after
 
Hi Arif,

Sorry, I totally misunderstood what you were trying to
do. All you wanted to do was to detect a KeyUp event in
the frmBabyTest whenever a key is pressed on any controls
inside the frmBabyTest form, correct?

As I mentioned in my first response, the controls inside
the frmBabyTest form will receive the KeyUp event first.
As a result, the frmBabyTest never receives it.
Therefore, the control, that receives the KeyUp event,
needs to raise it to the frmBabyTest form.

For example:

private void TextBox1_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("From TextBox1_KeyUp");
this.OnKeyUp(e); // Raise the onKeyUp event
}

private void frmBabyTest_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("from frmBabyTest_KeyUp");
}

Don't forget to add this to the InitializeComponent() or
frmBabyTest constructor:

this.KeyUp += new System.Windows.Forms.KeyEventHandler
(this. frmBabyTest_KeyUp);

This will work. I tested it out on my test MDI app.
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"







-----Original Message-----
<<< I need to raise event on child form keyup >>>.
my code is not working that i mentioned in first post. I also tried ur
approach for the parent form to recieve the event keyup and raise it,
this is also not working. just to check for events in child forms, i
tried to define a mouse click event on the child form, it is perfectly
working.
I dnt understand that why keyup event is not working on child form of
an mdi application. is it a limitation on c#?
could u plz help.
regards
Arif
"Thomas Ha [MSFT]" <[email protected]> wrote in
message news: said:
You have to make sure the controls inside frmTestBaby
form do not receive the KeyUp event first. This may not
be possible. Also, clicking on the button does not raise
a KeyUp event.

I read your original question again. If you just want
the parent to receive an event when the child form is
loaded, you should have the parent capture the
frmTestBaby.Load event instead of the KeyUp event.

Try the following code:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.Load += new System.EventHandler
(this.frmTestBaby_Load);
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

private void frmTestBaby_Load(object sender,
System.EventArgs e)
{
MessageBox.Show("child form loaded");
}

Please let me know if I've misunderstood your question
again. I hope this will point you to the right path.

Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"

-----Original Message-----
Thanks Thomas, I tried the code but still it did not work :( any other
idea please share with me

"Thomas Ha [MSFT]" <[email protected]> wrote
in
message news:<056b01c3bacc$50eefc40 [email protected]>...
Hi,

If I understand you correctly, you want to raise an event
from the child form so the parent form can receive the
event. If that's what you want, here's what you
can
try.
1. Add the event handler to the frmTestParent form:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();

frmTestBaby.KeyUp += new
System.Windows.Forms.KeyEventHandler
(this.frmTestBaby_KeyUp);
}

2. Add the code to the frmTestParent form to handle the
event.

private void frmTestBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox("Event Receive from Parent: KeyUp was "
e.KeyCode);
}

This will only work if the frmTestBaby form does
not
have
a control (ie: text box) that will receive the KeyUp
event before the form. Otherwise, the control has to
raise the event so the form will receive it.

Hope this helps,
Thomas

Disclaimer:
This posting is provided "AS IS" with no
warranties,
and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"



-----Original Message-----
hy,
I have an mdi application, i create a child form
and
I
want to know
when a button is pressed while that child form is loaded.
I have this code:

private void frmTestBaby_KeyUp(object sender, System.EventArgs e)
{
MessageBox.Show("keyboard button pressed!");
}
Following is the code to load the frmTestBaby

private void menuItem2_Click(object sender, System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

Can someone help out to how to get the event
raised
KeyUp for the
child form frmTestBaby.
Please note that I have also tried activating the
child
form after
frmTestBaby.Show(); but it did not work.

regards
.

.
.
 
hy Thomas, I think that I could not communicate well. I neeed to raise
KeyUp event OF the CHILD Form. For example if the child form name is
frmBaby then I need to have some action on
frmBaby_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("Key up on child form frmBaby");
}
I DO NOT want to raise events on the controls of child form now.
can you tell me how to do this? or can you guide me if i could find
some documents detailing this or in worse case if C# is able to handle
child form events?

i hope you know what i mean.
regards

Thomas Ha said:
Hi Arif,

Sorry, I totally misunderstood what you were trying to
do. All you wanted to do was to detect a KeyUp event in
the frmBabyTest whenever a key is pressed on any controls
inside the frmBabyTest form, correct?

As I mentioned in my first response, the controls inside
the frmBabyTest form will receive the KeyUp event first.
As a result, the frmBabyTest never receives it.
Therefore, the control, that receives the KeyUp event,
needs to raise it to the frmBabyTest form.

For example:

private void TextBox1_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("From TextBox1_KeyUp");
this.OnKeyUp(e); // Raise the onKeyUp event
}

private void frmBabyTest_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("from frmBabyTest_KeyUp");
}

Don't forget to add this to the InitializeComponent() or
frmBabyTest constructor:

this.KeyUp += new System.Windows.Forms.KeyEventHandler
(this. frmBabyTest_KeyUp);

This will work. I tested it out on my test MDI app.
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"







-----Original Message-----
<<< I need to raise event on child form keyup >>>.
my code is not working that i mentioned in first post. I also tried ur
approach for the parent form to recieve the event keyup and raise it,
this is also not working. just to check for events in child forms, i
tried to define a mouse click event on the child form, it is perfectly
working.
I dnt understand that why keyup event is not working on child form of
an mdi application. is it a limitation on c#?
could u plz help.
regards
Arif
"Thomas Ha [MSFT]" <[email protected]> wrote in
message news: said:
You have to make sure the controls inside frmTestBaby
form do not receive the KeyUp event first. This may not
be possible. Also, clicking on the button does not raise
a KeyUp event.

I read your original question again. If you just want
the parent to receive an event when the child form is
loaded, you should have the parent capture the
frmTestBaby.Load event instead of the KeyUp event.

Try the following code:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.Load += new System.EventHandler
(this.frmTestBaby_Load);
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

private void frmTestBaby_Load(object sender,
System.EventArgs e)
{
MessageBox.Show("child form loaded");
}

Please let me know if I've misunderstood your question
again. I hope this will point you to the right path.

Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"


-----Original Message-----
Thanks Thomas, I tried the code but still it did not work :( any other
idea please share with me

message [email protected]>...
Hi,

If I understand you correctly, you want to raise an event
from the child form so the parent form can receive the
event. If that's what you want, here's what you
can
try.
1. Add the event handler to the frmTestParent form:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();

frmTestBaby.KeyUp += new
System.Windows.Forms.KeyEventHandler
(this.frmTestBaby_KeyUp);
}

2. Add the code to the frmTestParent form to handle the
event.

private void frmTestBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox("Event Receive from Parent: KeyUp was "
e.KeyCode);
}

This will only work if the frmTestBaby form does
not
have
a control (ie: text box) that will receive the KeyUp
event before the form. Otherwise, the control has to
raise the event so the form will receive it.

Hope this helps,
Thomas

Disclaimer:
This posting is provided "AS IS" with no
warranties,
and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"



-----Original Message-----
hy,
I have an mdi application, i create a child form and
I
want to know
when a button is pressed while that child form is loaded.
I have this code:

private void frmTestBaby_KeyUp(object sender, System.EventArgs e)
{
MessageBox.Show("keyboard button pressed!");
}
Following is the code to load the frmTestBaby

private void menuItem2_Click(object sender, System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

Can someone help out to how to get the event
raised
KeyUp for the
 
Hi Arif,

I understand that's what you want. The last sample does
exactly what you want. You need to understand that if
your frmBaby has any controls (which it does), the
controls will receive the KeyUp event first if any are in
focus. Therefore your frmBaby never receive the event.
That's why each of your controls need to raise the KeyUp
event (frmBaby.KeyUp(e)) so the frmBaby will receive it.

You mentioned earlier that the click event works fine.
That's because you can click on an area of the form where
no controls are located. As a result, the frmBaby
receives the onclick event first instead of any controls.

Here's a test you can do. Remove all of your controls or
disable all of them in the frmBaby. Then capture the
KeyUp event in the frmBaby, you'll find out that it will
work without raising a KeyUp event from any controls.

Hope this will clarify the issue!
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"

-----Original Message-----
hy Thomas, I think that I could not communicate well. I neeed to raise
KeyUp event OF the CHILD Form. For example if the child form name is
frmBaby then I need to have some action on
frmBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("Key up on child form frmBaby");
}
I DO NOT want to raise events on the controls of child form now.
can you tell me how to do this? or can you guide me if i could find
some documents detailing this or in worse case if C# is able to handle
child form events?

i hope you know what i mean.
regards

"Thomas Ha" <[email protected]> wrote in message
Hi Arif,

Sorry, I totally misunderstood what you were trying to
do. All you wanted to do was to detect a KeyUp event in
the frmBabyTest whenever a key is pressed on any controls
inside the frmBabyTest form, correct?

As I mentioned in my first response, the controls inside
the frmBabyTest form will receive the KeyUp event first.
As a result, the frmBabyTest never receives it.
Therefore, the control, that receives the KeyUp event,
needs to raise it to the frmBabyTest form.

For example:

private void TextBox1_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("From TextBox1_KeyUp");
this.OnKeyUp(e); // Raise the onKeyUp event
}

private void frmBabyTest_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("from frmBabyTest_KeyUp");
}

Don't forget to add this to the InitializeComponent() or
frmBabyTest constructor:

this.KeyUp += new System.Windows.Forms.KeyEventHandler
(this. frmBabyTest_KeyUp);

This will work. I tested it out on my test MDI app.
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"







-----Original Message-----
<<< I need to raise event on child form keyup >>>.
my code is not working that i mentioned in first
post. I
also tried ur
approach for the parent form to recieve the event
keyup
and raise it,
this is also not working. just to check for events in child forms, i
tried to define a mouse click event on the child
form,
it is perfectly
working.
I dnt understand that why keyup event is not working
on
child form of
an mdi application. is it a limitation on c#?
could u plz help.
regards
Arif
"Thomas Ha [MSFT]" <[email protected]> wrote
in
message news:<02ca01c3bb62$2c13cc70 [email protected]>...
You have to make sure the controls inside frmTestBaby
form do not receive the KeyUp event first. This
may
not
be possible. Also, clicking on the button does not raise
a KeyUp event.

I read your original question again. If you just want
the parent to receive an event when the child form is
loaded, you should have the parent capture the
frmTestBaby.Load event instead of the KeyUp event.

Try the following code:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.Load += new System.EventHandler
(this.frmTestBaby_Load);
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

private void frmTestBaby_Load(object sender,
System.EventArgs e)
{
MessageBox.Show("child form loaded");
}

Please let me know if I've misunderstood your question
again. I hope this will point you to the right path.

Thomas

Disclaimer:
This posting is provided "AS IS" with no
warranties,
and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"


-----Original Message-----
Thanks Thomas, I tried the code but still it did
not
work :( any other
idea please share with me

"Thomas Ha [MSFT]" <[email protected]>
wrote
in
message [email protected]>...
Hi,

If I understand you correctly, you want to raise
an
event
from the child form so the parent form can
receive
the
event. If that's what you want, here's what you can
try.

1. Add the event handler to the frmTestParent form:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();

frmTestBaby.KeyUp += new
System.Windows.Forms.KeyEventHandler
(this.frmTestBaby_KeyUp);
}

2. Add the code to the frmTestParent form to
handle
the
event.

private void frmTestBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox("Event Receive from Parent:
KeyUp
was "
e.KeyCode);
}

This will only work if the frmTestBaby form does not
have
a control (ie: text box) that will receive the KeyUp
event before the form. Otherwise, the control
has
to
raise the event so the form will receive it.

Hope this helps,
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties,
and
confers no rights. "Use of included script
samples
are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"



-----Original Message-----
hy,
I have an mdi application, i create a child
form
and
I
want to know
when a button is pressed while that child form
is
loaded.
I have this code:

private void frmTestBaby_KeyUp(object sender, System.EventArgs e)
{
MessageBox.Show("keyboard
button
pressed!");
}
Following is the code to load the frmTestBaby

private void menuItem2_Click(object sender, System.EventArgs e)
{
frmTBaby frmTestBaby =
new
frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();
}

Can someone help out to how to get the event
raised
KeyUp for the
child form frmTestBaby.
Please note that I have also tried activating the
child
form after
frmTestBaby.Show(); but it did not work.

regards
.

.

.
.
 
Thank you very much Thomas. Its working now.

Thomas Ha said:
Hi Arif,

I understand that's what you want. The last sample does
exactly what you want. You need to understand that if
your frmBaby has any controls (which it does), the
controls will receive the KeyUp event first if any are in
focus. Therefore your frmBaby never receive the event.
That's why each of your controls need to raise the KeyUp
event (frmBaby.KeyUp(e)) so the frmBaby will receive it.

You mentioned earlier that the click event works fine.
That's because you can click on an area of the form where
no controls are located. As a result, the frmBaby
receives the onclick event first instead of any controls.

Here's a test you can do. Remove all of your controls or
disable all of them in the frmBaby. Then capture the
KeyUp event in the frmBaby, you'll find out that it will
work without raising a KeyUp event from any controls.

Hope this will clarify the issue!
Thomas

Disclaimer:
This posting is provided "AS IS" with no warranties, and
confers no rights. "Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"

-----Original Message-----
hy Thomas, I think that I could not communicate well. I neeed to raise
KeyUp event OF the CHILD Form. For example if the child form name is
frmBaby then I need to have some action on
frmBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox.Show("Key up on child form frmBaby");
}
I DO NOT want to raise events on the controls of child form now.
can you tell me how to do this? or can you guide me if i could find
some documents detailing this or in worse case if C# is able to handle
child form events?

i hope you know what i mean.
regards

"Thomas Ha" <[email protected]> wrote in message
post. I
also tried urkeyup
and raise it,form,
it is perfectlyon
child form of
may
not warranties,
and
not
work :( any other
idea please share with me

"Thomas Ha [MSFT]" <[email protected]>
wrote
in
message [email protected]>...
Hi,

If I understand you correctly, you want to raise
an
event
from the child form so the parent form can
receive
the
event. If that's what you want, here's what you
can
try.

1. Add the event handler to the frmTestParent form:

private void menuItem2_Click(object sender,
System.EventArgs e)
{
frmTBaby frmTestBaby = new frmTBaby();
frmTestBaby.MdiParent = this;
frmTestBaby.Show();

frmTestBaby.KeyUp += new
System.Windows.Forms.KeyEventHandler
(this.frmTestBaby_KeyUp);
}

2. Add the code to the frmTestParent form to
handle
the
event.

private void frmTestBaby_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
MessageBox("Event Receive from Parent:
KeyUp
was "
has
to samples
are form
and is
loaded. button
pressed!"); new
frmTBaby();
.
 
Back
Top