Tumble
Tumble

Reputation: 53

modal forms and shared data,

I've written a couple of c# forms applications which use a lot of the same data/objects which would better be combined. I realise I could use modal forms to launch each of these but where should I state .dll's and other resources, on the parent form? or on each other form where necessary?

Upvotes: 0

Views: 178

Answers (2)

Kamran Khan
Kamran Khan

Reputation: 9986

A quick solution may seem like using singleton/static objects; but it may cause trouble in case you have multiple users accessing your business objects.

The other thing that you can do is that you add your objects in Master Form, and call master form objects from child forms.

Just as a side note, you can also think about a 3 tier approach:

  1. The data layer, if any that you have.
  2. Your business objects; the business logic layer.
  3. The presentation layer;

Access your BLL via your presentation and change whatever, wherever(which Form), and however(defined in your BLL). Use data layer to manipulate your business.

Upvotes: 0

serhio
serhio

Reputation: 28586

The things you can use:

  • static objects;
  • singleton pattern;
  • pass objects in forms constructors or properties;
  • use inherited forms, keeping in the base all common properties.

Upvotes: 1

Related Questions