Q: Activated

  • Thread starter Thread starter G .Net
  • Start date Start date
G

G .Net

Hi

Is there a way to explicitly get the Activated event of a form to be called?

Thanks

G
 
Question...

are you calling the Activated event because there is code in that event that
you want to execute? or do you want to 'Activate' the form?

If you are calling the Activated event because you want to execute the code
in that event sub routine, I would recommend moving the code from the
activated event and place it in your own routine ... myActivated or
something ... call your myActivated routine from the form's activated event
and any other place in your code that requires your myActivated
functionality. I would avoid triggering events to simply run
functionality...isolate the functionality in a seperate routine ... and call
this routine from all the events.

If you are calling this method to activate the form ... does setting focus
to the form trigger the event? If your form already has focus, and you need
to 'reproduce' the activated functionality, refer to above suggestion,
isolate the activated functionality in your own routine and make calls to
this routine from the activated event and any other place you need it.

I find 'triggering' system events lead to performance hits ... Also, I would
be careful coding you activated event ... you or the user could end up in an
endless loop.

Make sense?

Jeff

Do not fix the issue, solve the problem.
 
Hi Jeff

Thanks for your comments.

Yes, I wanted to call code within the Activate event. However, as you
indicated, this did lead to problems so I did as you suggested i.e. wrote a
myActivated routine. This now works fine.

Thanks for all your help.

G
 
Back
Top