Hi Craig,

I don't know how, but it does succeed in finding the one with the name
"SamDataModule", because it's not exactly access violations, but rather
incorrect data. I'm thinking that maybe it has a list of Forms /
Datamodules by name, and finds them by name?

But yeah, I was going to go on setting them at run time unless someone
had a better answer.

Samuel

-----Original Message-----
From: Craig Goodall [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08 2003 1:46 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Form / DataModule Creation


Hi Allan,

The DataSource lives on the form and the datasets in the DataModule. If 
you create these objects at runtime, you must link the DataSource(s), 
(and the odd visual component as you mentioned) to the associated 
dataset at runtime. How else will the form know the address and which 
datamodule / dataset it's talking to?

Regards,
Craig.


Allan, Samuel wrote:

>I have a form / datamodule pair that are created / destroyed together, 
>and there can be more than one instance of this pair. Visual components

>on the form are linked at design time to datasources / datasets on the 
>datamodule.
>
>The first pair (named SamForm and SamDataModule) create fine. The 
>second pair (SamForm_1 and SamDataModule_1) do not. The visual 
>components on SamForm_1 are all linked to SamDataModule and not 
>SamDataModule_1, which is what I want.
>
>I worked around this by re-setting all the links for the visual 
>components by hand at creation. However, this is not a good solution. 
>Someone else maintaining my code must know what I am doing and why. If 
>I add a new DBEdit then I have to remember to add the linking code to 
>the creation as well, or the DBEdit will look at the wrong data. Simply

>moving the DataSource to the form lessens the impact, but does not 
>eliminate the problem, and some people in my work disagree with doing 
>this. Also, some visual components, like InfoPower link directly to the

>dataset anyway. This must be something that others have experienced.
>
>Is there a better solution?
>
>_______________________________________________
>Delphi mailing list
>[EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
>
>.
>
>  
>

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to