 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michelle Brennan Guest
|
Posted: Thu Jan 19, 2006 4:56 am Post subject: Newbie Quaestion on Referencing dataset from ShowModal Windo |
|
|
I have a form containing an ADO dataset. I want to have a
ShowModal form have access to the parent form's dataset.
Since the modal form is shared among many different parent
forms, I don't want to implement this with USES MyParentForm,
but instead "reference" the parent's dataset object with a
dataset object variable in the modal form.
I tried this:
****** Parent Form
MyModalWindow := TMyModalWindow.Create(Self);
MyModalWindow.MyModalDatasetObject := MyParentDataset;
MyModalWindow.ShowModal;
****** MyModalWindow
Public Declaration
MyModalDatasetObject: TADODataSet;
....
If MyModalDatasetObject.State in [dsInsert, dsEdit] then
Do Something...
Although there are no compilation errors, this approach doesn't
work.. I guess I'm not referencing the parent form's dataset
correctly. Can anyone please give me some sample code to
accomplish this?
Thanks.
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Thu Jan 19, 2006 1:22 pm Post subject: Re: Newbie Quaestion on Referencing dataset from ShowModal W |
|
|
Michelle Brennan wrote:
| Quote: |
I have a form containing an ADO dataset. I want to have a
ShowModal form have access to the parent form's dataset.
Since the modal form is shared among many different parent
forms, I don't want to implement this with USES MyParentForm,
but instead "reference" the parent's dataset object with a
dataset object variable in the modal form.
I tried this:
****** Parent Form
MyModalWindow := TMyModalWindow.Create(Self);
MyModalWindow.MyModalDatasetObject := MyParentDataset;
MyModalWindow.ShowModal;
****** MyModalWindow
Public Declaration
MyModalDatasetObject: TADODataSet;
...
If MyModalDatasetObject.State in [dsInsert, dsEdit] then
Do Something...
Although there are no compilation errors, this approach doesn't
work.. I guess I'm not referencing the parent form's dataset
correctly. Can anyone please give me some sample code to
accomplish this?
Thanks.
|
"doesn't work"??? Your code should work.
--
Bill Todd (TeamB)
|
|
| Back to top |
|
 |
Josh Fraser Guest
|
Posted: Fri Jan 20, 2006 5:04 pm Post subject: Re: Newbie Quaestion on Referencing dataset from ShowModal W |
|
|
Are you using db aware controls? in the modal form are you reassigning
the dataset to them?
If you step into the code does MymodalDatasetobject get a value when you
create the form?
Bill Todd wrote:
| Quote: | Michelle Brennan wrote:
I have a form containing an ADO dataset. I want to have a
ShowModal form have access to the parent form's dataset.
Since the modal form is shared among many different parent
forms, I don't want to implement this with USES MyParentForm,
but instead "reference" the parent's dataset object with a
dataset object variable in the modal form.
I tried this:
****** Parent Form
MyModalWindow := TMyModalWindow.Create(Self);
MyModalWindow.MyModalDatasetObject := MyParentDataset;
MyModalWindow.ShowModal;
****** MyModalWindow
Public Declaration
MyModalDatasetObject: TADODataSet;
...
If MyModalDatasetObject.State in [dsInsert, dsEdit] then
Do Something...
Although there are no compilation errors, this approach doesn't
work.. I guess I'm not referencing the parent form's dataset
correctly. Can anyone please give me some sample code to
accomplish this?
Thanks.
"doesn't work"??? Your code should work.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|