View previous topic :: View next topic |
Author |
Message |
dnarayan
Joined: 22 Oct 2007 Posts: 3
|
Posted: Mon Nov 05, 2007 2:49 am Post subject: Add a virtualrecord to a virtualrecordset |
|
|
Is there any way to add a virtualrecord to a virtualrecordset (without affecting the database in any way)? This is for viewing purposes only in a virtual tree. I want to be able to view an extra row with ancillary information for some queries.
Cheers,
Daniel |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Nov 05, 2007 11:54 pm Post subject: |
|
|
There isn't any way to add a VirtualRecord that can be browsed as part of a VirtualRecordset without actually adding it to the database.
If what you want is a summary type row in VirtualTree (eg to show averages or sums) then the best way to do this is probably to create your own composite list class that implements the IList interface, and return an instance of this composite list in the VirtualTree.GetChildren event/method.
The composite list class methods would mostly just call through to the corresponding VirtualRecordset method but the Count property would return the VirtualRecordset.Count + 1 and the Item method would check the index and if it is VirtualRecordset.Count would return your summary object.
The composite list would also need to implement the IBindingList interface, handling ListChanged events from the VirtualRecordset and passing these on - so that VirtualTree (and other controls) are still notified of changes to the VIrtualRecordset. _________________ Infralution Support |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|