Samuel Allan asks: > 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.
This is a very annoying Delphi issue that occurs due to a collision between the object renaming code during creation, and the property streaming global name resolution code. It bites exactly as you have described and a comprehensive solution requires a certain amount of work, Here's the approach we take at avoid this problem. 1. We have derived a new modified TDataSource class in which the DataSet property value is not loaded at run time, only during design time. This ensures that no design time values can accidentlly be loaded during run time execution, and provides for a good safe starting position for later code. 2. We our forms initialise they create their associated data module and use a utility method to the appropiate DataSet values to all DataSources they contain. This is achieved by locating all DataSources on the form, and mapping from their name (eg srcFred) and locating a matching TDataset derived object with a matching name (eg tblFred). 3. Any DataSources that don't locate a matching DataSet raise an error as this is obviously a programming error. In cirsumstances where we do have DataSource that need special initialisation in code we have an extra property that indicates that they should be skipped by the step 2. processing code and these are handles later in the forms initialisation. This is all a lot of work to solve the issue, but as we have all of the code tucked in our TDataSource and Tform derived classes it is usually no visible when you are programming. The only decipline required in in the naming conventions for datasources and datasets, but you already have that in place don't you 8-) Cheers, Max. _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
