default click behavior of radio button on showing child form

P

Peted

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top