Sharing dataset

  • Thread starter Thread starter Richard Grene
  • Start date Start date
R

Richard Grene

How can I share a dataset that is filled in one form with other forms in my
app. I create the dataset through code using a oledata adapter.

Thanks,
Richard
 
Just build a property on your otherforms for your dataset. Pass it there,

When you pass it though, clear the dataset and perform a Merge. Otherwise
if you set it directly i.e. form2.dataset = form1.dataset,

you will be creating an object reference (which isn't always bad... but it
can cause problems if you want to do anything like canceling.) just means
more work sometimes.

HTH,
CJ
 
Hi Richard,

When you want that dataset in more forms it is easier to put it in a shared
class.

How much you put in that class is your decission. But do not put the
datahandling in it, create for that another class. Keep in mind that all the
things you transport with datasets are only the references.

I hope this helps?

Cor
 
Back
Top