BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Newbie Quaestion on Referencing dataset from ShowModal Windo

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Michelle Brennan
Guest





PostPosted: Thu Jan 19, 2006 4:56 am    Post subject: Newbie Quaestion on Referencing dataset from ShowModal Windo Reply with 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.

Back to top
Bill Todd
Guest





PostPosted: Thu Jan 19, 2006 1:22 pm    Post subject: Re: Newbie Quaestion on Referencing dataset from ShowModal W Reply with quote



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





PostPosted: Fri Jan 20, 2006 5:04 pm    Post subject: Re: Newbie Quaestion on Referencing dataset from ShowModal W Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.