Home All Groups Group Topic Archive Search About

Activating Windows Forms

Author
16 Feb 2006 8:10 PM
simchajoy2000
Hi,

Let me see if I can explain this, I have noticed that when I create new
windows forms (within my larger window form which serves as the primary
interface with dropdown menus etc) that sometimes you can activate more
than one window at once if you click back and forth enough.  Normally I
wouldn't care but it actually causes me huge problems down the line
because when I try to get the ActiveMdiChild.ActiveControl it could be
either of the two forms which are active.  My code assumes that this
can not happen so a whole bunch of things break.

Is there a way to make sure that all the other windows get disactivated
when one is activated?

Any suggestions?  Thank you!

Joy

Author
17 Feb 2006 3:07 PM
tomb
You just have to verify which form is actually active prior to doing
anything with it.  This is the envrionment in which you program.  Your
code's assumption is wrong - never assume anything!

Tom

simchajoy2***@yahoo.com wrote:

Show quoteHide quote
>Hi,
>
>Let me see if I can explain this, I have noticed that when I create new
>windows forms (within my larger window form which serves as the primary
>interface with dropdown menus etc) that sometimes you can activate more
>than one window at once if you click back and forth enough.  Normally I
>wouldn't care but it actually causes me huge problems down the line
>because when I try to get the ActiveMdiChild.ActiveControl it could be
>either of the two forms which are active.  My code assumes that this
>can not happen so a whole bunch of things break.
>
>Is there a way to make sure that all the other windows get disactivated
>when one is activated?
>
>Any suggestions?  Thank you!
>
>Joy
>

>
Author
17 Feb 2006 5:29 PM
simchajoy2000
No I do check to make sure the form is active before doing anything -
the problem is there are two forms active at one time.