469,890 Members | 2,316 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

Q: Activated

Hi

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

Thanks

G
Oct 3 '06 #1
4 1415
"G .Net" <no********@email.comschrieb:
Is there a way to explicitly get the Activated event of a form to be
called?
Call the form's 'Activate' method.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Oct 3 '06 #2

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.

"G .Net" <no********@email.comwrote in message
news:x6********************@pipex.net...
Hi

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

Thanks

G

Oct 3 '06 #3
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

"jeff" <jhersey at allnorth dottt comwrote in message
news:eZ**************@TK2MSFTNGP04.phx.gbl...
>
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.

"G .Net" <no********@email.comwrote in message
news:x6********************@pipex.net...
>Hi

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

Thanks

G


Oct 3 '06 #4
Thanks Herfried. Obvious when I thought about it!

G

"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:uP**************@TK2MSFTNGP06.phx.gbl...
"G .Net" <no********@email.comschrieb:
>Is there a way to explicitly get the Activated event of a form to be
called?

Call the form's 'Activate' method.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Oct 3 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Dennis | last post: by
14 posts views Thread by kenfar | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.