MDI application - updating all Winforms data at once

  • Thread starter Thread starter STom
  • Start date Start date
S

STom

I have an MDI (VB.net) application that has 5 winforms.

One Winform is where the user does the primary user input. It has about 10
different fields to enter values in. The other Winforms are just variations
of calculation of the data.

My intent is to have one base class that all the forms derive from and then
raise an event in that class whenver a change happens on the form with the
data entry.

My question here is how should I notify the base class of the change? Should
I just use the txtchange event of the edit boxes and call into the base
class to notify that a change has happened?

Any ideas would be appreciated.

Thanks.

STom
 
STom said:
I have an MDI (VB.net) application that has 5 winforms.
My question here is how should I notify the base class of the change? Should
I just use the txtchange event of the edit boxes and call into the base
class to notify that a change has happened?

I don't quite understand the need for the base class?

One thing I'd consider here would be to use the Model-View-Controler
architectural pattern. It's not as scary as it sounds. First of all, define
an object to contain the information that your user will input. At the
moment your user input form is storing this data, but it may help to have an
object do this instead. Your user input form will update this object,
perhaps when the user clicks Apply, or if you prefer each time any value on
the form changes. This will cause the object to raise an event named
"Updated". Your other forms would also have a reference to the underlying
object, and redraw themselves each time they receive the "Updated" event.

A search on google for MVC, Model-View-Controller, or Observer pattern may
lead you to some interesting and informative resources.

Hope this helps.

Tobin
 
Tobin,

Yes, you are correct, sorry for the confusion on the base class thing, what
I meant is like you said, have a class that is storing the data and
accepting notification from the form. I am currently doing what you
describe now, so I guess I'm not too far off track.

Thanks.

STom
 
Back
Top