Unanswered: share TreeView control on multiple forms
I inherited a database that uses an ActiveX treeView contol to display a some information related to our projects. This view is used in several places in the application and is rebuilt every time. This causes two problems:
1. The building of the tree control takes several seconds and several database queries (It could probably be improved but I am not real familar with the tree control) so the forms take longer to load.
2. The more important issue is there are now several views of the same data each with minor differences. If a node is changed, added or deleted it does not reflect on the other form until it is reloaded, which of course takes more time and user interaction.
My question: Is there a way to have a single instance of this treeView that can be displayed on multiple forms? I tried sending the treeView reference from the first form to the second form called but I was unable to use it in the second form.
My suggestion would be to make one form for just the tree control. If this new form is a pop-up form, but NOT modal. That way, this new form will always be on top of any other form that is open. By using the .MoveSize method for moving or sizing forms, you can place this form over the spot on the other forms where it would be if it were part of that form. Now, if this tree control NEEDS to be on the form because of referencing items on that form, or because the tree control will be doing some navigation, then you might need to put a reference on the Tree Control form as to which form it is "currently" attached to.