From: win on
I have a MDI Parent Forms

I see several Forms in the Parent Form and each must be updated by a
timer.

Is better to put a timer in any format,
or is it better to put a single parent timer on the form, which
updates the form in it?

Thank you.
From: Peter Duniho on
win wrote:
> I have a MDI Parent Forms
>
> I see several Forms in the Parent Form and each must be updated by a
> timer.
>
> Is better to put a timer in any format,
> or is it better to put a single parent timer on the form, which
> updates the form in it?

Define "better".

Assuming you are using System.Windows.Forms.Timer, then it seems to me
that the nature of the usage would be the primary factor:

� If the timer is always the same interval regardless of child forms,
it can easily go in the parent form. If not, then it should go into the
child forms for practicality.

� If the timer's Tick event handler is primarily dependent on things
in the parent form, then you might as well use the parent form for the
timer. On the other hand, if the event handler needs to handle things
specific to each child, and especially if each child is itself a
different form class, then it would probably make more sense to also put
the timer itself in the child forms.

There may be some value in consolidating the timers to a single instance
in the parent form if you expect to have a very large number of child
forms. But I would guess that this should not be factor for any
reasonably small number of child forms and your initial design choice
should probably not try to address that question. If and when you find
a resource contention problem with too many timers then you can look to
an alternative implementation to address that. Most likely, it will
never come to that.

If you have some other criteria for "better" than convenience of usage
and code maintainability, then you should be more specific about your
question and explain that.

Pete