472,146 Members | 1,358 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

default click behavior of radio button on showing child form

Hi

Im using c# express edition 2005
I have an MDI form, where i load multiple child forms from a dll i
create, using reflection and late binding

The child forms have multiple radio buttons in a groupbox, and have
the appearence set to button

My problem is, they have functions that are in thier click events, but
every time i hide then show, make visible a child form the click event
from the last selected radio button fires off.

I need the click event only to fire on an actual click and not when
the child form is hide then show.

When the child form is opened for the first time the radio button with
tab index 0 fires , then its the last selected radio button
any help appreciated on how i can stop this auto click on showing the
child form
thanks

Peted
May 4 '07 #1
2 2732
Peted,

This is the expected behavior, unfortunately.

The best solution I can think of is to have a flag that you set when you
don't want the event handler code to fire (like when the form is being
shown, etc, etc) and then set it when you perform your action. When done,
set the flag back.

Then, in your click event handler, check the flag. If it is set, exit
the method, otherwise, process normally.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Petedwrote in message news:dd********************************@4ax.com...
Hi

Im using c# express edition 2005
I have an MDI form, where i load multiple child forms from a dll i
create, using reflection and late binding

The child forms have multiple radio buttons in a groupbox, and have
the appearence set to button

My problem is, they have functions that are in thier click events, but
every time i hide then show, make visible a child form the click event
from the last selected radio button fires off.

I need the click event only to fire on an actual click and not when
the child form is hide then show.

When the child form is opened for the first time the radio button with
tab index 0 fires , then its the last selected radio button
any help appreciated on how i can stop this auto click on showing the
child form
thanks

Peted

May 4 '07 #2
thanks for the info

On Fri, 4 May 2007 15:19:06 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
>Peted,

This is the expected behavior, unfortunately.

The best solution I can think of is to have a flag that you set when you
don't want the event handler code to fire (like when the form is being
shown, etc, etc) and then set it when you perform your action. When done,
set the flag back.

Then, in your click event handler, check the flag. If it is set, exit
the method, otherwise, process normally.
May 8 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by J.A.Rank | last post: by
reply views Thread by leo001 | last post: by

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.