Home All Groups Group Topic Archive Search About
Author
3 Oct 2006 1:56 PM
G .Net
Hi

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

Thanks

G

Author
3 Oct 2006 2:06 PM
Herfried K. Wagner [MVP]
"G .Net" <nodamnspam@email.com> schrieb:
> 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/>
Author
3 Oct 2006 4:00 PM
G .Net
Thanks Herfried. Obvious when I thought about it!

G

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uPmvXUv5GHA.3808@TK2MSFTNGP06.phx.gbl...
> "G .Net" <nodamnspam@email.com> schrieb:
>> 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/>
Author
3 Oct 2006 3:50 PM
jeff
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.

Show quoteHide quote
"G .Net" <nodamnspam@email.com> wrote in message
news:x6ednYnRJ_mP8b_YRVnysA@pipex.net...
> Hi
>
> Is there a way to explicitly get the Activated event of a form to be
> called?
>
> Thanks
>
> G
>
Author
3 Oct 2006 3:59 PM
G .Net
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

Show quoteHide quote
"jeff" <jhersey at allnorth dottt com> wrote in message
news:eZRCcOw5GHA.4644@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" <nodamnspam@email.com> wrote in message
> news:x6ednYnRJ_mP8b_YRVnysA@pipex.net...
>> Hi
>>
>> Is there a way to explicitly get the Activated event of a form to be
>> called?
>>
>> Thanks
>>
>> G
>>
>
>