ComponentOne True DataControl 8.0
Modifying True DataControl Collections from Code

Usually, you will set up a True DataControl at design time, filling its Fields and other collections in property pages.

In more involved cases, you may need to modify True DataControl collections in code. There are some restrictions concerning where you are allowed to do that and what that might cause. All True DataControl functionality depends on the collections settings, so they can’t be allowed to change arbitrarily.

You are not allowed to modify True DataControl collections (or their item objects) in any way from True DataControl event procedures, except for one, specifically designed for that purpose – WillOpenData event. An attempt to change collections in other event will generate an error.

If you make any alteration to True DataControl collections outside the WillOpenData event, this will cause immediate refresh of the TData control. This includes all changes to collections and their item objects, even a simple operator setting a property of an object.

If you need more than one change at once (you usually do!), use the ChangeInProgress property. Setting it to True disables the automatic refresh so you can make multiple changes. After you are done with changes, set the ChangeInProgress property back to False, to let the refresh take place. Failure to return ChangeInProgress to False can lead to unpredictable results, since the True DataControl internal state will not be synchronized with its collection settings.

An exception to these rules is the collection returned by the NamedBookmarks property, which can be modified at any time, with no consequences.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback