>I have main application class oApp (Container) which has a oForms class collection (oForms class is made of Custom class in which I add with AddObject() forms that I want).
>When I add Form class with Private DataSession to oApp.oForms new DataSession is not creating. It stays on Default(1) data session.
>
>Why? What is the problem? Why it doesn't create new DataSession?
>
>In Debugger I can see that Form property DataSession is set to 2, but DataSessionID = 1.
This is because you're using AddObject to add the forms to the Custom object. Child objects take the DataSession of their parent. If you, instead, use AddProperty, you should get your private datasessions.
Note:
If you choose to use the AddProperty technique, you will need to add clean-up code in your Custom.Destroy event to kill all the forms that have been "added" to it. Using AddProperty doesn't create a Parent-Child relationship so the internal cleanup doesn't take place. You have to manually do it.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao