Is there any way to manage a dataset inside of a child form?
-
- Posts: 13
- Joined: Wed 07 May 2008 09:08
Is there any way to manage a dataset inside of a child form?
Hello everybody!
I have a little question, maybe for you is trivial but I couldn't discover how to make update, fill or clear of a dataset from a form which is child of the form which has the dataset.
I have tried to put the dataset as static, in that it works but when I exit from the project and enter again I have lots of warnings from all the datalinks complaining because they can't find the dataset.
Any another solution?
Thanks a lots for your help. Regards,
Manuel J. Romero
I have a little question, maybe for you is trivial but I couldn't discover how to make update, fill or clear of a dataset from a form which is child of the form which has the dataset.
I have tried to put the dataset as static, in that it works but when I exit from the project and enter again I have lots of warnings from all the datalinks complaining because they can't find the dataset.
Any another solution?
Thanks a lots for your help. Regards,
Manuel J. Romero
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
-
- Posts: 13
- Joined: Wed 07 May 2008 09:08
Hi!
Let's see how can I access to a parent variable from the child if I don't have the reference of the parent? For example I have:
A parent form named parentForm with a public dataset named dataset1, if I call that form from another form I should make:
parentForm pF = new parentForm();
and now I could make pF.dataset1.Fill();
But from a child I don't have pF because this is the called form. At the moment I could access putting the dataset like static and from the child:
parentForm.dataset1.Fill()
What am I making wrong?
Thanks a lots for your help.
Let's see how can I access to a parent variable from the child if I don't have the reference of the parent? For example I have:
A parent form named parentForm with a public dataset named dataset1, if I call that form from another form I should make:
parentForm pF = new parentForm();
and now I could make pF.dataset1.Fill();
But from a child I don't have pF because this is the called form. At the moment I could access putting the dataset like static and from the child:
parentForm.dataset1.Fill()
What am I making wrong?
Thanks a lots for your help.
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
-
- Posts: 13
- Joined: Wed 07 May 2008 09:08
Thanks a lots for your example!
But in my case, my project is different because I'm using a form with the dataset and UserControls which I added to the form to create pages. So when I said child forms I wanted to say the child pages. And I can't inherit from the form because they are different classes.
At the moment I'm sending the dataset in the constructor of the pages, and when I make a clear or a fill operation it worksright because the objects, which use the "parent" dataset, update their contents at the same time when I refill the dataset in the child page.
Is this a good solution?
Thanks a lots for your help.
But in my case, my project is different because I'm using a form with the dataset and UserControls which I added to the form to create pages. So when I said child forms I wanted to say the child pages. And I can't inherit from the form because they are different classes.
At the moment I'm sending the dataset in the constructor of the pages, and when I make a clear or a fill operation it worksright because the objects, which use the "parent" dataset, update their contents at the same time when I refill the dataset in the child page.
Is this a good solution?
Thanks a lots for your help.
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
-
- Posts: 13
- Joined: Wed 07 May 2008 09:08
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24