Relating an object to a window in an MDI application

  • Thread starter Thread starter Mitchell Vincent
  • Start date Start date
M

Mitchell Vincent

I'm writing some business software, so I have a customer object that
holds customer data and all the logic to deal with that customer. The
problem is one of concept - I don't know how to tie the customer object
to a specific window. Since this app is MDI, it is possible for the user
to have more than one customer open at a time.

What is the "correct" way to tie a data/logic object to a window?

I realize that is an open ended question but I'm still trying to wrap my
head around Visual Studio.NET and this MDI stuff!

Thanks!
 
Hi,

I would recommend you take a look at the Model View Controller (MVC) design
pattern.

To give you a quick answer, why not let the Form class hold a reference to
the object that it is presenting the data for? When the Window is created it
is passed a reference to the object it is representing, this information can
either be passed in the constructor or set via property.

Hope this helps
 
Chris said:
Hi,

I would recommend you take a look at the Model View Controller (MVC) design
pattern.

To give you a quick answer, why not let the Form class hold a reference to
the object that it is presenting the data for? When the Window is created it
is passed a reference to the object it is representing, this information can
either be passed in the constructor or set via property.

Hope this helps
Thanks Chris. Sometimes the answer is so simple I can't wrap my head
around it!

I read your response and gave myself a big "Duuuuh!" slap!

Thanks again!!
 
Back
Top