Form Activate - Can it be bypassed?

  • Thread starter Thread starter David Webb
  • Start date Start date
D

David Webb

Hi,

I have code in the Form_Activate event of my application and as the
user needs to switch between many forms, I simply hide them when the
user needs to move to another form. At present, I have a global
boolean called gbExitNow and set this to true and test for its
condition in Form_Activate, in order to bypass the code in
Form_Activate when the user switches to another form.

I'm sure there is a more efficient or programatically correct way of
doing this and was wondering if someone can please provide an
alternative method where I can bypass the Form Activate at certain
times. E.g. when the user selects "Save & Exit" the save routine is
performed, the form_activate is executed before the form is hidden.

Thanks in advance for any assistance.

Kind Regards,

David.
 
Hey, there can't be 2 David Webb's posting in this group (-;

Your best bet is a form stack. When you want to close the app, loop through
the form stack and close them all.

Global class:
static ArrayList arrForms = new ArrayList();

In each form contructor:
Global.arrForms.Add(this);

In each form Closed event:
Global.arrForms.Remove(this);


-Dave
 
Gidday!

Yep, 2 David Webb(s) and my middle name starts with D as well -
freakey! Thanks for the code - isn't there an event I can set
somewhere which will bypass the form activate? I don't want to close
the forms as I continually use them and keep them in memory to make
the application quicker to flick between screens.

Regards,

David.
 
Back
Top