Datasets Question Again - CJ .anyone??? there?

  • Thread starter Thread starter Jeff Brown
  • Start date Start date
J

Jeff Brown

OK i removed all of my datasets to start fromo scratch again with another
method.

Is there a way i can create all my datasets in the MDI Parent form and
reference them from child forms
*******************
for instance i just created dsName1 in the MDi Parent and the dsName.xsd was
created in the solution.

Now i want 2 different child forms to be able to access certain data
contained in the dsname1 dataset.
they would probably work if i could reference the source dataset correctly.

childDsName = dsName1.Copy()
childDsName = formMain.dsName1.Copy()
childDsName = SolutionName.dsName1.Copy()
that should give me the structure and the data ,clone gives only the
structure
*******************
Now if i get that part working.. then to keep them updated i could put this
is the main windows "changeactivechild" (the same place where it updates the
mdilist on the menu) so that if i enter data from one form into the dataset
the other form can already access it
childDsName = dsName1.getchanges()
childDsName = formMain.dsName1.getchanges()
childDsName = SolutionName.dsName1.getchanges()
*******************
then on the childs form close so that it updates the dsName1 in the Parent?
childDsName.Merge(dsName1, True, System.Data.MissingSchemaAction.Add)

*******************

Is any of this close to being right????? If i solve this problem i think i
could be busy for a few days and just read posts , LOL.

If i could bind child form controls to the dataset on the parent i wouldn't
need to make a copy at all


so glad i found this newsgroup, i have given up trying to do this project
about 3 times in the past 3 months but i keep trying and get a little
farther only to realize i need to start over and do it a different way.

Thanks guys,
Jeff Brown
 
Jeff,

Sorry I got caught in meetings yesterday but I'll do my best to answer your
questions here.


Jeff Brown said:
OK i removed all of my datasets to start fromo scratch again with another
method.

Is there a way i can create all my datasets in the MDI Parent form and
reference them from child forms
*******************
for instance i just created dsName1 in the MDi Parent and the dsName.xsd was
created in the solution.

Now i want 2 different child forms to be able to access certain data
contained in the dsname1 dataset.
they would probably work if i could reference the source dataset correctly.

childDsName = dsName1.Copy()
childDsName = formMain.dsName1.Copy()
childDsName = SolutionName.dsName1.Copy()

^^^ Are these formMain and SolutionName instance variables? I didn't even
know you could reference something by solution name (if I'm wrong, someone
tell me).

No... No you can't... =)

Second of all, with formMain, I'm not positive but this looks like a Shared
reference, in which case that could be right, but I don't know if you have
it set up right.

in your childform I would do

dim tform as mdiMainForm (whatever the type is)
tForm = me.mdiParent
me.dsWhatever.merge (tForm.dsName1)

then when your child form closes or you want to do somethign to merge the
changes back in call your parent form to merge the child form... you could
do this on your form unload or whatever of your child

Dim tForm as mdiMainForm
tForm = me.mdiParent
tForm.dsName1.Merge (me.dsWhatever)

and then you can call your update logic. You could also do this with
events... But lets just stick with one thing at a time for right now.
Events may be better (basically pass the updated row back through a delegate
(then you also will be thread safe if you turn it into multi-threading...
thats a fun time)).
that should give me the structure and the data ,clone gives only the
structure
*******************
Now if i get that part working.. then to keep them updated i could put this
is the main windows "changeactivechild" (the same place where it updates the
mdilist on the menu) so that if i enter data from one form into the dataset
the other form can already access it
childDsName = dsName1.getchanges()
childDsName = formMain.dsName1.getchanges()
childDsName = SolutionName.dsName1.getchanges()

This is good... use this in with what I showed you above... also, if you try
to merge an empty dataset (because getChanges was empty) you'll get an
error.
*******************
then on the childs form close so that it updates the dsName1 in the Parent?
childDsName.Merge(dsName1, True, System.Data.MissingSchemaAction.Add)

yep yep
*******************

Is any of this close to being right????? If i solve this problem i think i
could be busy for a few days and just read posts , LOL.

Yeah this will take care of a lot of it. there are a lot of methods for
doing something like this. This is just one of them. Events are pretty
powerful too, in which case you can just let VB.NET take care of al ot of
the dirty work (so your not constantly declaring instances of forms and
datasets etc.)

hope it helps some more.

CJ
If i could bind child form controls to the dataset on the parent i wouldn't
need to make a copy at all


so glad i found this newsgroup, i have given up trying to do this project
about 3 times in the past 3 months but i keep trying and get a little
farther only to realize i need to start over and do it a different way.

Welcome to programming. I constantly want to do projects over.
 
Paul_IV

1.Declare DataSet in the Module (as Friend).
2.Fill up the instance of the DataSet (as Friend) with DataAdapters on
your Parent Form.
3.Reference your child forms directly to Parent forms Dataset.
4.For Updates on child forms use child form DataAdapters.
 
Back
Top